golib  0.5
goSinglePlot Class Reference

Single plot class used for goMultiPlotter. More...

#include <gnuplot.h>

Public Member Functions

 goSinglePlot (const goSinglePlot &)
 
const goSinglePlotoperator= (const goSinglePlot &)
 
bool operator== (const goSinglePlot &) const
 Returns false. Comparison doesn't make sense. More...
 
bool operator!= (const goSinglePlot &) const
 
void setPosition (goSize_t row, goSize_t col)
 Set position in multiplot. More...
 
goSize_t getRow () const
 Get row position in the multiplot grid. More...
 
goSize_t getColumn () const
 Get column position in the multiplot grid. More...
 
bool add3D (const goMath::Vectord &x, const goMath::Vectord &y, goIndex_t lineLength, const goMath::Vectord &values, const char *title, const char *plotOptions=0)
 Add 3D plot given by x,y,z coordinates. More...
 
bool add3D (const goMath::Vectorf &x, const goMath::Vectorf &y, goIndex_t lineLength, const goMath::Vectorf &values, const char *title, const char *plotOptions=0)
 Add 3D plot given by x,y,z coordinates. More...
 
bool add3D (const goMath::Matrixf &m, const char *title, const char *plotOptions=0, bool separateRows=false)
 
bool add3D (const goMath::Matrixd &m, const char *title, const char *plotOptions=0, bool separateRows=false)
 
bool add3D (const goSignal3DBase< void > *image, const char *title, const char *plotOptions=0)
 Add surface to draw as goSignal3DBase<void>. More...
 
bool addImage (const goMath::Matrixf &m, const char *title, const char *plotOptions=0)
 
bool addImage (const goMath::Matrixd &m, const char *title, const char *plotOptions=0)
 
bool addImage (const goSignal3DBase< void > &m, const char *title, const char *plotOptions=0)
 
bool add (const char *commands, const char *dataString=0)
 
bool add3D (const char *commands, const char *dataString=0)
 
bool addSphere (const char *plotOptions=0, goFloat radius=1.0f, bool autoRange=true)
 
template<class pointT >
bool addCurve (const goList< pointT > &points, const char *title, const char *plotOptions=0)
 
bool addCurve (const goMath::Vectord &x, const goMath::Vectord &y, const char *title, const char *plotOptions=0)
 Add a curve to the plot. More...
 
bool addCurve (const goMath::Vectorf &x, const goMath::Vectorf &y, const char *title, const char *plotOptions=0)
 Add a curve to the plot. More...
 
bool addCurveMatrix (const goMath::Matrixf &m, const char *title, const char *plotOptions=0)
 Add curve defined by configuration matrix. More...
 
bool addCurveMatrix (const goMath::Matrixd &m, const char *title, const char *plotOptions=0)
 
bool addPoint (const goMath::Vectorf &p, const char *title, const char *plotOptions=0)
 
bool addPoint (const goMath::Vectord &p, const char *title, const char *plotOptions=0)
 
bool addPlane (const goMath::Vectorf &n, const goMath::Vectorf &p, goDouble dx=0.1, goDouble dy=0.1, goDouble sx=1.0, goDouble sy=1.0, const char *title="", const char *plotOptions=0)
 
bool addPlane (const goMath::Vectord &n, const goMath::Vectord &p, goDouble dx=0.1, goDouble dy=0.1, goDouble sx=1.0, goDouble sy=1.0, const char *title="", const char *plotOptions=0)
 
bool addLine (const goMath::Vectorf &n, const goMath::Vectorf &p, const char *title="", const char *plotOptions=0)
 
bool addLine (const goMath::Vectord &n, const goMath::Vectord &p, const char *title="", const char *plotOptions=0)
 
template<class vectorT >
bool addCurve (const vectorT &v, const char *title, const char *plotOptions=0)
 
void setPrefix (const goString &p)
 
void setPrefix (const char *p)
 
const goStringgetPrefix () const
 
void setTitle (const goString &s)
 
void setTitle (const char *s)
 
const goStringgetTitle () const
 
bool addLabel (const goString &l, goDouble x, goDouble y, const char *colourspec="", const char *options="")
 Add a label at a given position. More...
 
bool addLabel (const char *l, goDouble x, goDouble y, const char *colourspec="", const char *options="")
 
bool addLabel (const goString &l, goDouble x, goDouble y, goDouble z, const char *colourspec="", const char *options="")
 
bool addLabel (const char *l, goDouble x, goDouble y, goDouble z, const char *colourspec="", const char *options="")
 
bool writeGnuplotDataFiles () const
 
bool makePlot (goString &plotCommandsRet, bool useDataFiles=false) const
 Create all necessary temporary files and create gnuplot command string. More...
 
bool addGnuplotCommands (goString &commandsRet) const
 
void removeFiles () const
 Removes temporary files. More...
 
void clear ()
 Clears all curves. Does not clear the prefix command string.
 
void setUseFiles (bool f)
 
bool getUseFiles () const
 
- 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

Single plot class used for goMultiPlotter.

Examples
karchermean/km.cpp, and so3/so3.cpp.

Member Function Documentation

◆ add3D() [1/3]

bool goSinglePlot::add3D ( const goMath::Vectord x,
const goMath::Vectord y,
goIndex_t  lineLength,
const goMath::Vectord values,
const char *  title,
const char *  plotOptions = 0 
)

Add 3D plot given by x,y,z coordinates.

Note
In the gnuplot prefix, add "set dgrid3d" to see a 3d grid.
Parameters
xx coordinates
yy coordinates
lineLengthLength of the grid in x-direction (number of elements in one line)
valuesz values
titleTitle
plotOptionsplot options as in the other add* functions.
Returns
True if successful, false otherwise.

◆ add3D() [2/3]

bool goSinglePlot::add3D ( const goMath::Vectorf x,
const goMath::Vectorf y,
goIndex_t  lineLength,
const goMath::Vectorf values,
const char *  title,
const char *  plotOptions = 0 
)

Add 3D plot given by x,y,z coordinates.

Note
In the gnuplot prefix, add "set dgrid3d" to see a 3d grid.
Parameters
xx coordinates
yy coordinates
lineLengthLength of the grid in x-direction (number of elements in one line)
valuesz values
titleTitle
plotOptionsplot options as in the other add* functions.
Returns
True if successful, false otherwise.

◆ add3D() [3/3]

bool goSinglePlot::add3D ( const goSignal3DBase< void > *  image,
const char *  title,
const char *  plotOptions = 0 
)

Add surface to draw as goSignal3DBase<void>.

Note
Only the current channel of the 0th z slice will be used since it is assumed the input signal is a 2D image.
Parameters
imageImage object. May not be deleted as long as this goSinglePlot uses it.
titleTitle.
plotOptionsOptions for gnuplot (like "with lines", "with points").
Returns
True if successful, false otherwise.

◆ addCurve() [1/2]

bool goSinglePlot::addCurve ( const goMath::Vectord x,
const goMath::Vectord y,
const char *  title,
const char *  plotOptions = 0 
)

Add a curve to the plot.

Parameters
xX coordinates of curve points.
yY coordinates of curve points.
titleTitle of the curve (set to "" for none).
plotOptionsOptions for gnuplot, written after the plot command, default is "w l" for "with lines". E.g. set this to "with linespoints" for drawing with points and lines.
Returns
True if successful, false otherwise.

◆ addCurve() [2/2]

bool goSinglePlot::addCurve ( const goMath::Vectorf x,
const goMath::Vectorf y,
const char *  title,
const char *  plotOptions = 0 
)

Add a curve to the plot.

Parameters
xX coordinates of curve points.
yY coordinates of curve points.
titleTitle of the curve (set to "" for none).
plotOptionsOptions for gnuplot, written after the plot command, default is "w l" for "with lines". E.g. set this to "with linespoints" for drawing with points and lines.
Returns
True if successful, false otherwise.

◆ addCurveMatrix()

bool goSinglePlot::addCurveMatrix ( const goMath::Matrixf m,
const char *  title,
const char *  plotOptions = 0 
)

Add curve defined by configuration matrix.

The matrix contains one point per row. Dimensions must be m x 2, where m is the number of points.

Parameters
mConfiguration matrix.
titleTitle of the curve.
plotOptionsOptions (see addCurve() functions).
Returns
True if successful, false otherwise.

◆ addLabel()

bool goSinglePlot::addLabel ( const goString l,
goDouble  x,
goDouble  y,
const char *  colourspec = "",
const char *  options = "" 
)

Add a label at a given position.

Parameters
lLabel text.
xPosition X
yPosition Y
Returns
True if successful, false otherwise.

◆ getColumn()

goSize_t goSinglePlot::getColumn ( ) const

Get column position in the multiplot grid.

Returns
Column position.

◆ getRow()

goSize_t goSinglePlot::getRow ( ) const

Get row position in the multiplot grid.

Returns
Row position.

◆ makePlot()

bool goSinglePlot::makePlot ( goString plotCommandsRet,
bool  useDataFiles = false 
) const

Create all necessary temporary files and create gnuplot command string.

Parameters
plotCommandsRetContains the command string after the function returned true.
Returns
True if successful, false otherwise.

◆ operator==()

bool goSinglePlot::operator== ( const goSinglePlot ) const

Returns false. Comparison doesn't make sense.

Returns
false

◆ removeFiles()

void goSinglePlot::removeFiles ( ) const

Removes temporary files.

This is only safe to use when the gnuplot command has returned. goMultiPlotter copies the single plots, so the user will usually not have to deal with this. If the plot is not paused for user input after plotting (goMultiPlotter::setPauseFlag()), the files are not deleted automatically and are left for a system service to clean (usually in /tmp).

◆ setPosition()

void goSinglePlot::setPosition ( goSize_t  row,
goSize_t  col 
)

Set position in multiplot.

Sets the position in the goMultiPlotter grid. The user does not have to set this, it is set with goMultiPlotter::addPlot().

Parameters
rowRow
colColumn

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