golib  0.5
Plotting with Gnuplot

These are the functions and classes related to plotting with gnuplot. You will generally want to use only. More...

Classes

class  goSinglePlot
 Single plot class used for goMultiPlotter. More...
 
class  goMultiPlotter
 Plotting multiple plots in one window (or on one page). More...
 
class  goPlot::Gnuplot
 Convenience interface to goMultiPlotter and goSinglePlot. More...
 

Enumerations

enum  PlotType { Normal, Surface }
 

Functions

template<class T >
void goPlot::plot (const goMath::Vector< T > &x, const goMath::Vector< T > &y, const char *title=0, const char *plotOptions=0, const char *prefix=0)
 Convenience function for quickly plotting something. More...
 
template<class T >
void goPlot::plot (const goMath::Vector< T > &y, const char *title=0, const char *plotOptions=0, const char *prefix=0)
 
template<class T >
void goPlot::plot (const goMath::Matrix< T > &points, const char *title=0, const char *plotOptions=0, const char *prefix=0)
 Convenience function for quickly plotting something. More...
 
template<class T >
void goPlot::plot3D (const goMath::Matrix< T > &M, const char *title, const char *plotOptions=0, const char *prefix=0, bool separateRows=false)
 
template<class arrayT >
bool goPlot::gnuplot (const arrayT &array, const char *title=0, const char *gnuplotCommands=0, const char *prefixCommands=0, const char *shellPostfix=0, goString *cmdFileNameRet=0, goString *dataFileNameRet=0, bool waitfor=false)
 Plots 1D data using gnuplot. More...
 
template<class arrayT , class arrayT2 >
bool goPlot::gnuplot (const arrayT &array, const arrayT2 &array2, const char *title=0, const char *gnuplotCommands=0, const char *prefixCommands=0, const char *shellPostfix=0, goString *cmdFileNameRet=0, goString *dataFileNameRet=0, bool waitfor=false)
 
template<class arrayT >
bool goPlot::gnuplotList (const goList< arrayT > *arrayListX, const goList< arrayT > *arrayListY=0, goList< goString > *title=0, goList< goString > *plotCommands=0, const char *prefixCommands=0, const char *postfixCommands=0, const char *shellPostfix=0, goString *cmdFileNameRet=0, goList< goString > *dataFileNameRet=0, bool waitfor=true)
 
bool goPlot::callGnuplot (const goString &gnuplotCommands, const char *shellPostfix, bool waitfor, goString *cmdFilenameRet, int redirectInputFD=-1, int redirectOutputFD=-1)
 
bool goPlot::addGnuplotCommands (goString &gnuplotCommands, const goList< goString > *dataFileNames, const goList< goString > *titles, const goList< goString > *plotCommands, const char *prefixCommands, const char *postfixCommands, goPlot::PlotType plotType=goPlot::Normal)
 
template<class arrayT >
bool goPlot::writeGnuplotDataFiles (const goList< arrayT > *arrayListX, const goList< arrayT > *arrayListY, goList< goString > &dataFileNameRet)
 
template<class arrayT >
bool goPlot::writeGnuplotDataFiles (const goList< arrayT > *arrayListX, const goList< arrayT > *arrayListY, const goList< arrayT > *arrayListZ, goIndex_t lineLength, goList< goString > &dataFileNameRet)
 
template<class T >
bool goPlot::writeGnuplotDataFiles (const goList< goMath::Matrix< T > > *matrix, goList< goString > &dataFileNameRet)
 
template<class T >
bool goPlot::writeGnuplotDataFilesBinary (const goList< goMath::Matrix< T > > *matrix, goList< goString > &dataFileNameRet)
 
bool goPlot::writeGnuplotDataFiles (const goList< const goSignal3DBase< void > * > *images, goList< goString > &dataFileNameRet)
 

Detailed Description

These are the functions and classes related to plotting with gnuplot. You will generally want to use only.

Function Documentation

◆ gnuplot()

template<class arrayT >
bool goPlot::gnuplot ( const arrayT &  array,
const char *  title = 0,
const char *  gnuplotCommands = 0,
const char *  prefixCommands = 0,
const char *  shellPostfix = 0,
goString cmdFileNameRet = 0,
goString dataFileNameRet = 0,
bool  waitfor = false 
)

Plots 1D data using gnuplot.

Before calling the plot command, <prefixCommands> are executed in gnuplot and then plot <filename> <gnuplotCommands>. If a shell postfix is given, gnuplot is called in a shell like gnuplot <shellPostfix>. You can e.g. use this to redirect output for postscript terminal type. The calling process can either wait for gnuplot to finish or call it the non-blocking way; this is selected with the waitFor parameter.
This function is currently implemented for goArray and goFixedArray template classes with goFloat and goDouble template parameters.

Parameters
arrayArray, currently goArray<> and goFixedArray<> of types goFloat and goDouble are supported.
titleTitle of the plot.
gnuplotCommandsCommands that come with the plot command, like this: plot <filename> <gnuplotCommands>. You could for example put "with dots" or similar here. If left null, "with lines" is assumed.
prefixCommandsGnuplot commands that go before the plot command. You can for example put commands to select the terminal type here.
shellPostfixIf this is not null, gnuplot is called in a shell (/bin/sh) and this string is put after the gnuplot command string. Use this e.g. for "> my_file.ps" if you use postscript terminal.
cmdFileNameRetIf not null, the command file name used by gnuplot (a temporary file) is stored here after the call.
dataFileNameRetIf not null, the data file name used by gnuplot (a temporary file) is stored here after the call.
waitforIf true, the calling process blocks until gnuplot has finished. If false, the calling process does not block.
Returns
True if successful, false otherwise.

◆ plot() [1/2]

template<class T >
void goPlot::plot ( const goMath::Matrix< T > &  points,
const char *  title = 0,
const char *  plotOptions = 0,
const char *  prefix = 0 
)

Convenience function for quickly plotting something.

For quick one-line plotting commands. Creates a goMultiPlotter and goSinglePlot, adds the given curve with options and prefix commands, sets the pause flag in goMultiPlotter to true (so that each plot waits for a key press) and calls plot().

Parameters
pointsN x 2 point configuration matrix of the curve.
titleTitle (of the curve).
plotOptionsOptions for gnuplot (like "with lines")
prefixPrefix commands for gnuplot (like "set ..." commands)

◆ plot() [2/2]

template<class T >
void goPlot::plot ( const goMath::Vector< T > &  x,
const goMath::Vector< T > &  y,
const char *  title = 0,
const char *  plotOptions = 0,
const char *  prefix = 0 
)

Convenience function for quickly plotting something.

For quick one-line plotting commands. Creates a goMultiPlotter and goSinglePlot, adds the given curve with options and prefix commands, sets the pause flag in goMultiPlotter to true (so that each plot waits for a key press) and calls plot().

Parameters
xX coordinates.
yY coordinates.
titleTitle (of the curve).
plotOptionsOptions for gnuplot (like "with lines")
prefixPrefix commands for gnuplot (like "set ..." commands)