golib  0.5
goMultiPlotter Class Reference

Plotting multiple plots in one window (or on one page). More...

#include <gnuplot.h>

Public Member Functions

 goMultiPlotter (goSize_t rows, goSize_t cols)
 Constructor. More...
 
 goMultiPlotter (goMultiPlotter &)
 
void setInputFD (int fd)
 Set input file descriptor. More...
 
void setOutputFD (int fd)
 Set output file descriptor. More...
 
goMultiPlotteroperator= (goMultiPlotter &)
 
void addPlot (const goSinglePlot &, goSize_t row, goSize_t col, goFloat extentRow=1.0f, goFloat extentCol=1.0f)
 Add a plot at a given position. More...
 
void addPlot (const goSinglePlot &, goSize_t index)
 
void addPlotBarycentric (goSinglePlot &p, goDouble u, goDouble v, goDouble w, goDouble xsize, goDouble ysize)
 
goSize_t getRows () const
 Get number of rows in the multiplot grid. More...
 
goSize_t getColumns () const
 Get number of columns in the multiplot grid. More...
 
void setWaitFlag (bool w)
 Set wait flag (default true). More...
 
bool getWaitFlag () const
 Get wait flag. More...
 
void setPauseFlag (bool p)
 Set pause flag. More...
 
bool getPauseFlag () const
 Get pause flag. More...
 
void setSingleFlag (bool s)
 
bool getSingleFlag () const
 
void setAutoPosition (bool a)
 
bool getAutoPosition () const
 
void setBarycentric (const goMath::Matrixf &triangle)
 
void setBarycentric (const goMath::Matrixd &triangle)
 
void setPrefix (const goString &)
 Set a gnuplot command prefix. More...
 
void setPrefix (const char *)
 
void setPostfix (const goString &)
 Set a gnuplot command postfix. More...
 
void setPostfix (const char *)
 
void setTitle (const char *)
 
bool makePlotCommands (goString &plotCommandsRet)
 
virtual bool plot (goGnuplot *gp=0)
 Plot all plots. More...
 
virtual bool plotPostscript (const goString &filename, goFloat sizeX=-1.0f, goFloat sizeY=-1.0f)
 Plot to a postscript file. More...
 
virtual bool plotEPS (const goString &filename)
 Plot to a postscript file. More...
 
virtual bool plotFile (const goString &filename, const goString &type)
 Plot to a specified output terminal and pipe output to file. More...
 
bool plotPostscript (const char *filename, goFloat sizeX=-1.0f, goFloat sizeY=-1.0f)
 
bool plotEPS (const char *filename)
 
bool plotFile (const char *filename, const char *type)
 
bool saveGnuplot (const char *filename)
 
void clear ()
 Clears all commands and plots and resets flags to default values.
 
void removeFiles ()
 Remove all data and command files.
 
- Public Member Functions inherited from goObjectBase
 goObjectBase ()
 Constructor.
 
virtual ~goObjectBase ()
 Destructor. More...
 
const char * getClassName () const
 Returns the class name. More...
 
int getClassID () const
 
virtual goSize_t memoryUsage () const
 Returns the size of this object or some measure of its memory consumption. More...
 
void setObjectName (const char *name)
 Set name string for an object. More...
 
void setObjectName (const goString &name)
 Set name string for an object. More...
 
const goStringgetObjectName () const
 Get the object name. More...
 
virtual bool writeObjectFile (FILE *) const
 Write object to a file. More...
 
virtual bool readObjectFile (FILE *)
 Read object from a file. More...
 
void connectObject (goObjectBase *object)
 Connects an object to this object. More...
 
void disconnectObject (const goObjectBase *object)
 Disconnects an object from this object.
 
virtual bool callObjectMethod (int methodID, goObjectMethodParameters *param=NULL)
 Call an object method by identifier. More...
 
virtual bool queueObjectMethod (int methodID, goObjectMethodParameters *param=NULL, bool blocking=false)
 Enqueue a method call to an internal list of methods. More...
 
bool callQueuedMethods ()
 Call all queued methods. More...
 

Additional Inherited Members

- Protected Member Functions inherited from goObjectBase
void setClassID (int id)
 Sets the class name.
 
void printClassMessage (const char *msg)
 Sets the class name. More...
 
void printClassMessage (goString &msg)
 Prints an informational message to the calling console. More...
 
void sendObjectMessage (int messageID, void *data=NULL)
 Sends a message to all connected objects.
 
void sendObjectMessage (goObjectBase *object, int messageID, void *data=NULL)
 Sends a message to a specific object.
 
virtual void receiveObjectMessage (const goObjectMessage &message)
 Receive a message. More...
 

Detailed Description

Plotting multiple plots in one window (or on one page).

This is the plotting facility that should be used generally. It uses Gnuplot.

See also
goSinglePlot
goPlotter
Author
Christian Gosch
Examples
karchermean/km.cpp, and so3/so3.cpp.

Constructor & Destructor Documentation

◆ goMultiPlotter()

goMultiPlotter::goMultiPlotter ( goSize_t  rows,
goSize_t  cols 
)

Constructor.

Constructs a new goMultiPlotter with multiplot grid size (rows x cols). This means a grid with <rows> rows and <cols> columns of goSinglePlot objects can be drawn by the constructed object.

Parameters
rowsNumber of rows.
colsNumber of columns.

Member Function Documentation

◆ addPlot()

void goMultiPlotter::addPlot ( const goSinglePlot p,
goSize_t  row,
goSize_t  col,
goFloat  extentRow = 1.0f,
goFloat  extentCol = 1.0f 
)

Add a plot at a given position.

Adds a plot to the multiplot grid.

Parameters
pPlot.
rowRow position.
colColumn position.

◆ getColumns()

goSize_t goMultiPlotter::getColumns ( ) const

Get number of columns in the multiplot grid.

Returns
Number of columns.

◆ getPauseFlag()

bool goMultiPlotter::getPauseFlag ( ) const

Get pause flag.

Returns
Pause flag.

◆ getRows()

goSize_t goMultiPlotter::getRows ( ) const

Get number of rows in the multiplot grid.

Returns
Number of rows.

◆ getWaitFlag()

bool goMultiPlotter::getWaitFlag ( ) const

Get wait flag.

Returns
Wait flag.

◆ plot()

bool goMultiPlotter::plot ( goGnuplot gp = 0)
virtual

Plot all plots.

Parameters
gpgoGnuplot object pointer. If not null, all commands are sent to this object. A command files will then not be written.
Returns
True if successful, false otherwise.

◆ plotEPS()

bool goMultiPlotter::plotEPS ( const goString filename)
virtual

Plot to a postscript file.

Same as plotFile (filename, goString("postscript eps colour"));

Parameters
filenamePostscript file name.
Returns
True if successful, false otherwise.

◆ plotFile()

bool goMultiPlotter::plotFile ( const goString filename,
const goString type 
)
virtual

Plot to a specified output terminal and pipe output to file.

The command "set terminal <type>" is added to the prefix gnuplot command. The plotter (gnuplot) is called through a shell and the shell output is stored in <filename>.

All temporary files created by the plot are removed after plotting.

Parameters
filenameFilename to store the shell output in.
typeTerminal type (from gnuplot, e.g. "postscript color").
Returns
True if successful, false otherwise.

◆ plotPostscript()

bool goMultiPlotter::plotPostscript ( const goString filename,
goFloat  sizeX = -1.0f,
goFloat  sizeY = -1.0f 
)
virtual

Plot to a postscript file.

Same as plotFile (filename, goString("postscript colour"));

Parameters
filenamePostscript file name.
sizeXX size of canvas in cm.
sizeYY size of canvas in cm.
Returns
True if successful, false otherwise.

◆ setInputFD()

void goMultiPlotter::setInputFD ( int  fd)

Set input file descriptor.

Used for IO redirection.

See also
C library functions dup2(), pipe(), etc.
Parameters
fdFile descriptor.

◆ setOutputFD()

void goMultiPlotter::setOutputFD ( int  fd)

Set output file descriptor.

Used for IO redirection.

See also
C library functions dup2(), pipe(), etc.
Parameters
fdFile descriptor.

◆ setPauseFlag()

void goMultiPlotter::setPauseFlag ( bool  w)

Set pause flag.

If set to true, the plotter (gnuplot) waits for user input (usually <RET> on the console) until the program is resumed. To be precise, the gnuplot command "pause -1" is added at the end of the gnuplot command.

Parameters
wPause flag.

◆ setPostfix()

void goMultiPlotter::setPostfix ( const goString str)

Set a gnuplot command postfix.

This string is appended to the complete command string.

See also
setPrefix()
Parameters
strgnuplot commands.

◆ setPrefix()

void goMultiPlotter::setPrefix ( const goString p)

Set a gnuplot command prefix.

This string will be at the beginning of the gnuplot command. You can use this e.g. to set things like "unset xtics\nunset ytics\n".

Note
The string should be ended with a "\n" carriage return.
Parameters
pCommand string.

◆ setWaitFlag()

void goMultiPlotter::setWaitFlag ( bool  w)

Set wait flag (default true).

If true, the caller waits for the gnuplot process.

Parameters
wWait flag.

The documentation for this class was generated from the following files: