public class GNUPlot
extends java.lang.Object
It also provides some convenient methods in order to set various parameters.
This object is not serializable, use GNUPlotParameters instead.
JavaPlot
,
addPlot(Plot)
Constructor and Description |
---|
GNUPlot()
Create a new instance of gnuplot, using the default parameters
|
GNUPlot(boolean isGraph3D)
Create a new instance of gnuplot, using the default parameters.
|
GNUPlot(GNUPlotParameters par)
Create a new instance of gnuplot, with a given set of parameters.
|
GNUPlot(GNUPlotParameters par,
java.lang.String gnuplotpath,
GNUPlotTerminal term)
Create a new instance of gnuplot, with given parameters and given path
for gnuplot.
|
GNUPlot(GNUPlotParameters par,
java.lang.String gnuplotpath,
GNUPlotTerminal term,
boolean isGraph3D)
Create a new instance of gnuplot, with given parameters and given path
for gnuplot.
|
GNUPlot(java.lang.String gnuplotpath)
Create a new instance of gnuplot, with a given path for gnuplot.
|
GNUPlot(java.lang.String gnuplotpath,
boolean isGraph3D)
Create a new instance of gnuplot, with a given path for gnuplot.
|
Modifier and Type | Method and Description |
---|---|
void |
addGraph(Graph gr)
Add a defined graph to this GNUPlot object.
|
void |
addPlot(Plot plot)
Add a new Plot
|
Axis |
getAxis(java.lang.String axisname)
Use this method to get a reference to the plot axis, in order to set
various parameters.
|
java.lang.String |
getCommands()
Retrieves the command which will actually send to gnuplot, if we perform
a plot with the already defined parameters to the selected terminal.
|
static Debug |
getDebugger()
Get the specific GNUPlot Debug object
|
java.lang.String |
getGNUPlotPath()
Retrieve the file path of gnuplot
|
GraphLayout |
getLayout()
Get the current layout of this plot object
|
Page |
getPage()
Get a Page containing all Graphs.
|
GNUPlotParameters |
getParameters()
Ge the actual gnuplot parameters.
|
java.util.ArrayList<Plot> |
getPlots()
Get a list of the (default) plots used in this set.
|
java.util.ArrayList<java.lang.String> |
getPostInit()
Execute gnuplot commands before any kind of initialization.
|
java.util.ArrayList<java.lang.String> |
getPreInit()
Execute gnuplot commands before any kind of initialization.
|
GNUPlotTerminal |
getTerminal()
Get the current used terminal
|
void |
newGraph()
Add a new Graph object.
|
void |
newGraph3D()
Add a new Graph3D object.
|
void |
plot()
Perform the actual action of plotting.
|
void |
set(java.lang.String key,
java.lang.String value)
Set various GNUPlot parameters.
|
void |
setGNUPlotPath(java.lang.String path)
Set the desired path for gnuplot executable.
|
void |
setMultiTitle(java.lang.String title)
Set the title of all graph objects, in multiplot environment.
|
void |
setParameters(GNUPlotParameters parameters)
Set gnuplot parameters to another set of parameters.
|
void |
setPersist(boolean ispersist)
Set all terminals to be persistent.
|
void |
setTerminal(GNUPlotTerminal term)
Change gnuplot terminal.
|
public GNUPlot() throws GNUPlotException
GNUPlotException
- If the gnuplot executable
is not found, this exception is thrown. Typically at this case there is
need to use a constructor which defines the gnuplot path.GNUPlot(String)
,
GNUPlot(GNUPlotParameters,String,GNUPlotTerminal,boolean)
public GNUPlot(boolean isGraph3D) throws GNUPlotException
isGraph3D
- true if the default plot is Graph3DGNUPlotException
- If the gnuplot executable
is not found, this exception is thrown. Typically at this case there is
need to use a constructor which defines the gnuplot path.GNUPlot(String)
,
GNUPlot(GNUPlotParameters,String,GNUPlotTerminal,boolean)
public GNUPlot(GNUPlotParameters par) throws GNUPlotException
par
- Use this set of parameters, instead of a default one.GNUPlotException
- If the gnuplot executable
is not found, this exception is thrown. Typically at this case there is
need to use a constructor which defines the gnuplot path.GNUPlot(String)
,
GNUPlot(GNUPlotParameters,String,GNUPlotTerminal,boolean)
public GNUPlot(java.lang.String gnuplotpath) throws GNUPlotException
gnuplotpath
- The pathname of the gnuplot executable. If this
parameter is set to null, use the default path.GNUPlotException
- If the gnuplot executable
is not found, this exception is thrown. It means that the provided path
for gnuplot is not valid.public GNUPlot(java.lang.String gnuplotpath, boolean isGraph3D) throws GNUPlotException
gnuplotpath
- The pathname of the gnuplot executable. If this
parameter is set to null, use the default path.isGraph3D
- true if the default plot is Graph3DGNUPlotException
- If the gnuplot executable
is not found, this exception is thrown. It means that the provided path
for gnuplot is not valid.public GNUPlot(GNUPlotParameters par, java.lang.String gnuplotpath, GNUPlotTerminal term) throws GNUPlotException
This constructor is useful if the user wants to fine tune eny aspect of GNUPlot object, and especially if there is need to define a priori the output terminal.
Any parameters set to null, produce the default parameters.
par
- GNUPlot parameters to use. These parameters encapsulate the
whole gnuplot variables, including data sets.gnuplotpath
- The pathname of the gnuplot executable. If this
parameter is set to null, use the default path.term
- The gnuplot terminal to useGNUPlotException
- If the gnuplot executable
is not found, this exception is thrown. It means that the provided path
for gnuplot is not valid.public GNUPlot(GNUPlotParameters par, java.lang.String gnuplotpath, GNUPlotTerminal term, boolean isGraph3D) throws GNUPlotException
This constructor is useful if the user wants to fine tune eny aspect of GNUPlot object, and especially if there is need to define a priori the output terminal.
Any parameters set to null, produce the default parameters.
par
- GNUPlot parameters to use. These parameters encapsulate the
whole gnuplot variables, including data sets.gnuplotpath
- The pathname of the gnuplot executable. If this
parameter is set to null, use the default path.term
- The gnuplot terminal to useisGraph3D
- true, if this is a Graph3D objectGNUPlotException
- If the gnuplot executable
is not found, this exception is thrown. It means that the provided path
for gnuplot is not valid.public void set(java.lang.String key, java.lang.String value)
key
- The key to use for this gnuplotvalue
- The value of this keypublic Axis getAxis(java.lang.String axisname)
axisname
- The name of the axis. This typically is "x", "y", "z".public void addPlot(Plot plot)
plot
- The plot to add to the list of plots.Plot
public void addGraph(Graph gr)
gr
- Graph object to be addednewGraph()
public void newGraph()
newGraph3D()
public void newGraph3D()
newGraph()
public void setMultiTitle(java.lang.String title)
title
- The title to usepublic java.util.ArrayList<Plot> getPlots()
public Page getPage()
public GraphLayout getLayout()
public void plot() throws GNUPlotException
GNUPlotException
- This exception is thrown
if an error occured. Use the Debug object to dump information about this
error.public java.lang.String getCommands()
public void setGNUPlotPath(java.lang.String path) throws java.io.IOException
path
- Filename of gnuplot executablejava.io.IOException
- gnuplot is not found, or not validpublic java.lang.String getGNUPlotPath()
public void setPersist(boolean ispersist)
ispersist
- whether the terminal window should be persistentpublic void setParameters(GNUPlotParameters parameters)
parameters
- The new GNUPlot parameters.public GNUPlotParameters getParameters()
public void setTerminal(GNUPlotTerminal term)
term
- The terminal to usepublic GNUPlotTerminal getTerminal()
public static Debug getDebugger()
public java.util.ArrayList<java.lang.String> getPreInit()
public java.util.ArrayList<java.lang.String> getPostInit()