gtkIOStream  1.7.0
GTK+ << C++ IOStream operators for GTK+. Now with ORBing, numerical computation, audio client and more ...
Plot Class Reference

simplistic plotting class which mimicks a octave approach to plotting Use this class as if you were plotting in octave. More...

#include <Plot.H>

Inheritance diagram for Plot:
[legend]
Collaboration diagram for Plot:
[legend]

Public Member Functions

 Plot (void)
 
void setBackground (const char *clsStr)
 
void setBackground (ColourLineSpec cls)
 
void setBackground (const GdkColor gdkC)
 
GtkWidget * gca (void)
 Get the current axis. More...
 
GtkWidget * getCurrentAxis (void)
 Get the current axis. More...
 
void show (void)
 
void hide (void)
 
GtkDataboxGraph * plot (gfloat *x, gfloat *y, int cnt)
 
GtkDataboxGraph * plot (gfloat *x, gfloat *y, int cnt, const char *clsChar)
 
GtkDataboxGraph * plot (gfloat *x, gfloat *y, int cnt, ColourLineSpec &cls)
 
GtkDataboxGraph * plot (gfloat *x, gfloat *y1, gfloat *y2, int cnt)
 
GtkDataboxGraph * plot (gfloat *x, gfloat *y1, gfloat *y2, int cnt, const char *clsChar)
 
GtkDataboxGraph * plot (gfloat *x, gfloat *y1, gfloat *y2, int cnt, ColourLineSpec &cls)
 
GtkDataboxGraph * semilogx (gfloat *x, gfloat *y, int cnt)
 Plots with a logarithmic ordinate scale Plotting the data with a logarithmic ordinate scale and a default colour. More...
 
GtkDataboxGraph * semilogx (gfloat *x, gfloat *y, int cnt, const char *clsChar)
 Plots with a logarithmic ordinate scale Plotting the data with a logarithmic ordinate scale. More...
 
GtkDataboxGraph * semilogx (gfloat *x, gfloat *y, int cnt, ColourLineSpec &cls)
 Plots with a logarithmic ordinate scale Plotting the data with a logarithmic ordinate scale. More...
 
GtkDataboxGraph * semilogx (gfloat *x, gfloat *y1, gfloat *y2, int cnt)
 Plots with a logarithmic ordinate scale Plotting the data with a logarithmic ordinate scale and a default colour Each x ordinate has two y co-ordinates - resulting in offset bars. More...
 
GtkDataboxGraph * semilogx (gfloat *x, gfloat *y1, gfloat *y2, int cnt, const char *clsChar)
 Plots with a logarithmic ordinate scale Plotting the data with a logarithmic ordinate scale and a default colour Each x ordinate has two y co-ordinates - resulting in solid regions if line plotting. More...
 
GtkDataboxGraph * semilogx (gfloat *x, gfloat *y1, gfloat *y2, int cnt, ColourLineSpec &cls)
 Plots with a logarithmic ordinate scale Plotting the data with a logarithmic ordinate scale and a default colour Each x ordinate has two y co-ordinates - resulting in solid regions if line plotting. More...
 
GtkDataboxGraph * semilogy (gfloat *x, gfloat *y, int cnt)
 Plots with a logarithmic co-ordinate scale Plotting the data with a logarithmic co-ordinate scale and a default colour. More...
 
GtkDataboxGraph * semilogy (gfloat *x, gfloat *y, int cnt, const char *clsChar)
 Plots with a logarithmic co-ordinate scale Plotting the data with a logarithmic co-ordinate scale. More...
 
GtkDataboxGraph * semilogy (gfloat *x, gfloat *y, int cnt, ColourLineSpec &cls)
 Plots with a logarithmic co-ordinate scale Plotting the data with a logarithmic co-ordinate scale. More...
 
GtkDataboxGraph * loglog (gfloat *x, gfloat *y, int cnt)
 Plots with logarithmic ordingate and co-ordinate scales Plotting the data with logarithmic ordinate and co-ordinate scales and a default colour. More...
 
GtkDataboxGraph * loglog (gfloat *x, gfloat *y, int cnt, const char *clsChar)
 Plots with logarithmic ordingate and co-ordinate scales Plotting the data with logarithmic ordinate and co-ordinate scales and a default colour. More...
 
GtkDataboxGraph * loglog (gfloat *x, gfloat *y, int cnt, ColourLineSpec &cls)
 Plots with logarithmic ordingate and co-ordinate scales Plotting the data with logarithmic ordinate and co-ordinate scales. More...
 
GtkDataboxGraph * text (gfloat *x, gfloat *y, const char *textDisp, const char *clsChar)
 
GtkDataboxGraph * text (gfloat *x, gfloat *y, const char *textDisp, ColourLineSpec &cls)
 
void clear (void)
 
void clf (void)
 
void hold (bool on)
 
void grid (bool on)
 
void grid (bool on, int hCnt, gfloat *hLines, int vCnt, gfloat *vLines)
 
void limits (float min_x, float max_x, float min_y, float max_y)
 Set the limits of the viewable region of the plot. This will set the viewable rectangle to be between the min/max specified x and y values. More...
 
void limits (gfloat border=0.)
 Set the limits to autoscale Rescales the figure to show everything plotted. More...
 
void replot (void)
 Instruct gtk to replot If the underlying plot data pointers haven't changed, it is not necessary to call plot again. Simply call this method to get gtk to replot the contents of the data pointers used in the last call to Plot::plot. More...
 
void set (GtkWidget *widget,...)
 sets the property of the figure Various figure axis settings. This list of settings must be NULL terminated. Valid options are (either camel or lower case): More...
 
void connectAfter (const char *event, GCallback callback, gpointer data)
 
void xLabel (const char *label, int *indexes=NULL)
 
void xLabelBL (const char *label)
 
void yLabel (const char *label, int *indexes=NULL)
 
void yLabelTL (const char *label)
 
void title (const char *titleStr, int *indexes=NULL)
 
void title (GtkWidget *widget, int *indexes=NULL)
 
void remove (GtkDataboxGraph *toRemove)
 
Plotoperator>> (GtkDataboxGraph *toRemove)
 
gfloat pixelToX (gint16 pixel)
 
gfloat pixelToY (gint16 pixel)
 
- Public Member Functions inherited from Table
 Table (void)
 
 Table (short int rows, short int cols, bool homogeneous=true, GtkAttachOptions xOpt=GTK_EXPAND, GtkAttachOptions yOpt=GTK_EXPAND, uint xPad=0, uint yPad=0)
 
void initialise (short int rows=2, short int cols=2, bool homogeneous=true, GtkAttachOptions xOpt=GTK_FILL, GtkAttachOptions yOpt=GTK_FILL, uint xPad=0, uint yPad=0)
 
void setHomogeneous (bool homogeneous)
 
void setOptions (GtkAttachOptions xOpt, GtkAttachOptions yOpt)
 
void setRegion (short int x_s, short int x_e, short int y_s, short int y_e)
 
void placeWidget (GtkWidget *obj, GtkAttachOptions xOpt, GtkAttachOptions yOpt)
 
void placeWidget (GtkWidget *obj)
 
void getSize (uint *rows, uint *cols)
 
void setPadding (uint xPad, uint yPad)
 
void resize (uint rows, uint cols)
 
Tableoperator<< (int i)
 
Tableoperator, (int i)
 
Tableoperator<< (int *region)
 
Tableoperator<< (GtkWidget *obj)
 
Tableoperator<< (LinkList< GtkWidget *> &ll)
 
Tableoperator<< (Container &b)
 
Tableoperator<< (Container *b)
 
Tableoperator<< (Widget &b)
 
Tableoperator<< (Widget *b)
 
Tableoperator>> (GtkWidget *obj)
 
Tableoperator>> (Container *c)
 
Tableoperator>> (Container &c)
 
Tableoperator>> (LinkList< GtkWidget *> &ll)
 
- Public Member Functions inherited from Container
void setBorder (unsigned int size)
 
unsigned int getBorder (void)
 
Containeroperator<< (Container &c)
 
Containeroperator<< (Container *c)
 
Containeroperator<< (Widget &w)
 
Containeroperator<< (Widget *w)
 
Containeroperator<< (LinkList< GtkWidget *> &ll)
 
Containeroperator>> (GtkWidget *w)
 
Containeroperator>> (Container *c)
 
Containeroperator>> (Container &c)
 
Containeroperator>> (LinkList< GtkWidget *> &ll)
 
void setChildrensSensitivity (bool sens)
 
bool areAnyChildrensSensitive (void)
 
unsigned int size ()
 
- Public Member Functions inherited from Widget
 Widget ()
 Construcotr. More...
 
 Widget (GtkWidget *w)
 
virtual ~Widget ()
 Destructor. More...
 
GtkWidget * ref (void)
 
void unref (void)
 
GtkWidget * show (void)
 
GtkWidget * hide (void)
 
bool getVisible (void)
 
GtkWidget * getWidget (void)
 
bool getSensitive (void)
 
void setSensitive (bool sens)
 
void getSize (int &width, int &height)
 
virtual void setSize (int width, int height)
 
void getLocationSize (int &x, int &y, int &width, int &height)
 
void queueDraw ()
 
GdkWindow * getWindow ()
 
void connect (const char *event, GCallback callback, gpointer data)
 
void connectAfter (const char *event, GCallback callback, gpointer data)
 
void connectExposeEventCallback (GCallback callback, void *data)
 
void connectExposeEventCallback (GtkWidget *w, GCallback callback, void *data)
 
void connectConfigureEventCallback (GCallback callback, void *data)
 
void connectConfigureEventCallback (GtkWidget *w, GCallback callback, void *data)
 
Widgetoperator<< (DragNDrop &dnd)
 
Widgetoperator>> (DragNDrop &dnd)
 

Protected Attributes

GtkWidget * axis
 The axis widget. More...
 
GtkDataboxGraph * gridGraph
 The grid which defaults to off. More...
 
bool holdOn
 Whether to hold the curves or not. More...
 
bool gridOn
 Whether to the grid is on. More...
 
- Protected Attributes inherited from Widget
GtkWidget * widget
 The container based widget. More...
 

Private Member Functions

template<typename TYPE >
GType findType (TYPE val)
 

Additional Inherited Members

- Protected Member Functions inherited from Container
virtual void pack (GtkWidget *obj)
 
- Protected Member Functions inherited from Widget
virtual bool checkDropValidity (GtkWidget *w, GtkWidget *sourceWidget, int info, const unsigned char *selectionStoredData)
 
virtual bool dragDataReceived (GtkWidget *w, GtkWidget *sourceWidget, int info, const unsigned char *selectionStoredData, int length)
 
virtual void dragLeave (GtkWidget *w, GtkWidget *sourceWidget)
 
virtual bool dragMotion (GtkWidget *w, GtkWidget *sourceWidget, int x, int y)
 
virtual int chooseTheTargetToUse (GtkWidget *w, GtkWidget *sourceWidget, DragNDrop &dnd)
 
virtual void dragDataGet (GtkWidget *w, GtkSelectionData *selectionData, guint info)
 
virtual void dragDataDelete (GtkWidget *w)
 
virtual void dragBegin (GtkWidget *w)
 
virtual void dragEnd (GtkWidget *w)
 

Detailed Description

simplistic plotting class which mimicks a octave approach to plotting Use this class as if you were plotting in octave.

See the readme files for information on how to get/install GtkDatabox (which is required for this Plot class)

The Plot can support a title, xaxis, xlabel, ylabel, yaxis, plot, yaxis (right), ylabel (right) like so :

==================================================================
| | yLabelTL | title | | |
==================================================================
| | | | | |
| yLabel | yaxis | plot | yaxis2 | yLabel2 |
| | | | | |
==================================================================
| | xLabelBL | xaxis | | |
==================================================================
| | | xLabel | | |
==================================================================

Here is an example of how to use :

vector<float> x, y; // make sure you put some data into x and y
Plot figure;
figure.semilogx(&x[0],&y[0], x.size());
//figure.limits(1, 100, 1, 100); // make sure you put suitable min/max values for x and y here, if you want to change the ranges shown by the plot.
figure.set(figure.gca(), (char*)"XTick", FALSE, (char*)"YTick", FALSE, NULL); // remove ticks
figure.set(figure.gca(), (char*)"YLabelRotate", "Horizontal", NULL); // put y labels horizontal
// NOTE : many other set options
figure.grid(true); // auto grid - NOTE : you can also set grid lines at specific points.
figure.xlabel("x label"); // set some axis labels
figure.ylabel("y label");
figure.title("title");
// once setup, if your data in x and y change, simply call : figure.replot(); This is a lightweight way to refresh the plot.

Here is an example with two plots in the same window :

PlotTest2.jpg
Examples:
NeuralNetworkFnTest.C, PlotTest.C, and PlotTest2.C.

Definition at line 89 of file Plot.H.

Constructor & Destructor Documentation

◆ Plot()

Plot::Plot ( void  )
inline

Construct a generic axis with a white background

Definition at line 128 of file Plot.H.

Member Function Documentation

◆ clear()

void Plot::clear ( void  )
inline

Clear the figure

Definition at line 605 of file Plot.H.

◆ clf()

void Plot::clf ( void  )
inline

Clear the figure

Definition at line 611 of file Plot.H.

◆ connectAfter()

void Plot::connectAfter ( const char *  event,
GCallback  callback,
gpointer  data 
)
inline

Connect a signal callback to the axis

Parameters
eventthe signal to generate the callback e.g. "expose-event"
callbackthe callback to call
datathe user data to pass to the callback

Definition at line 890 of file Plot.H.

◆ findType()

template<typename TYPE >
GType Plot::findType ( TYPE  val)
inlineprivate

Given a variable, find the associated GType.

Parameters
valThe variable to find the GType of.
Template Parameters
TYPEthe type of the variable
Returns
The GType on successful matching with gtkdatabox known gtypes. G_TYPE_INVALID otherwise.

Definition at line 96 of file Plot.H.

◆ gca()

GtkWidget* Plot::gca ( void  )
inline

Get the current axis.

Returns
the axis of the plot
Examples:
PlotTest2.C.

Definition at line 194 of file Plot.H.

◆ getCurrentAxis()

GtkWidget* Plot::getCurrentAxis ( void  )
inline

Get the current axis.

Returns
the axis of the plot

Definition at line 201 of file Plot.H.

◆ grid() [1/2]

void Plot::grid ( bool  on)
inline

Generates a grid on the axis Check if a grid exists in gtkdatabox, if it does, then re-use it. Defaults to 5 horizontal and vertical lines

Examples:
PlotTest2.C.

Definition at line 626 of file Plot.H.

◆ grid() [2/2]

void Plot::grid ( bool  on,
int  hCnt,
gfloat *  hLines,
int  vCnt,
gfloat *  vLines 
)
inline

Generates a grid on the axis

Parameters
onwhether to plot the grid
hCntThe number of horizontal lines
hLinesThe hCnt hLine points
vCntThe number of vertical lines
vLinesThe vCnt vLine points

Definition at line 644 of file Plot.H.

Here is the call graph for this function:

◆ hide()

void Plot::hide ( void  )
inline

Definition at line 211 of file Plot.H.

◆ hold()

void Plot::hold ( bool  on)
inline

Sets the axis to hold the current plots (curves) or to wipe them

Examples:
NeuralNetworkFnTest.C, and PlotTest2.C.

Definition at line 618 of file Plot.H.

◆ limits() [1/2]

void Plot::limits ( float  min_x,
float  max_x,
float  min_y,
float  max_y 
)
inline

Set the limits of the viewable region of the plot. This will set the viewable rectangle to be between the min/max specified x and y values.

Parameters
min_xThe minimum x value to show
max_xThe maximum x value to show
min_yThe minimum y value to show
max_yThe maximum y value to show
Examples:
NeuralNetworkFnTest.C, and PlotTest2.C.

Definition at line 678 of file Plot.H.

◆ limits() [2/2]

void Plot::limits ( gfloat  border = 0.)
inline

Set the limits to autoscale Rescales the figure to show everything plotted.

Parameters
borderThe fraction of the width and height to shrink the graph by, producing a border

Definition at line 696 of file Plot.H.

◆ loglog() [1/3]

GtkDataboxGraph* Plot::loglog ( gfloat *  x,
gfloat *  y,
int  cnt 
)
inline

Plots with logarithmic ordingate and co-ordinate scales Plotting the data with logarithmic ordinate and co-ordinate scales and a default colour.

Parameters
xThe ordinates for plotting
yThe co-ordinates for plotting
cntThe number of elements to plot
Returns
the graph which was just added.

Definition at line 538 of file Plot.H.

◆ loglog() [2/3]

GtkDataboxGraph* Plot::loglog ( gfloat *  x,
gfloat *  y,
int  cnt,
const char *  clsChar 
)
inline

Plots with logarithmic ordingate and co-ordinate scales Plotting the data with logarithmic ordinate and co-ordinate scales and a default colour.

Parameters
xThe ordinates for plotting
yThe co-ordinates for plotting
cntThe number of elements to plot
clsCharThe ColourLineSpec object to use for plotting
Returns
the graph which was just added.

Definition at line 551 of file Plot.H.

◆ loglog() [3/3]

GtkDataboxGraph* Plot::loglog ( gfloat *  x,
gfloat *  y,
int  cnt,
ColourLineSpec cls 
)
inline

Plots with logarithmic ordingate and co-ordinate scales Plotting the data with logarithmic ordinate and co-ordinate scales.

Parameters
xThe ordinates for plotting
yThe co-ordinates for plotting
cntThe number of elements to plot
clsThe ColourLineSpec object to use for plotting
Returns
the graph which was just added.

Definition at line 563 of file Plot.H.

◆ operator>>()

Plot& Plot::operator>> ( GtkDataboxGraph *  toRemove)
inline

Remove a single line or text from the graph (unplot).

Parameters
toRemoveThe object to remove from the plot figure.
Returns
A reference to the instance of this class.

Definition at line 1009 of file Plot.H.

◆ pixelToX()

gfloat Plot::pixelToX ( gint16  pixel)
inline

Find the Ordinate for a given pixel

Definition at line 1016 of file Plot.H.

◆ pixelToY()

gfloat Plot::pixelToY ( gint16  pixel)
inline

Find the Co-Ordinate for a given pixel

Definition at line 1022 of file Plot.H.

◆ plot() [1/6]

GtkDataboxGraph* Plot::plot ( gfloat *  x,
gfloat *  y,
int  cnt 
)
inline

Plots the cnt y values at x to the axis, with a default blue colour

Parameters
xThe ordinates for plotting
yThe co-ordinates for plotting
cntThe number of elements to plot
Returns
the graph which was just added.
Examples:
NeuralNetworkFnTest.C, PlotTest.C, and PlotTest2.C.

Definition at line 234 of file Plot.H.

◆ plot() [2/6]

GtkDataboxGraph* Plot::plot ( gfloat *  x,
gfloat *  y,
int  cnt,
const char *  clsChar 
)
inline

Plots the cnt y values at x to the axis, with a specified colour and line type

Parameters
xThe ordinates for plotting
yThe co-ordinates for plotting
cntThe number of elements to plot
clsCharThe specification to be used with the ColourLineSpec class
Returns
the graph which was just added.

Definition at line 260 of file Plot.H.

◆ plot() [3/6]

GtkDataboxGraph* Plot::plot ( gfloat *  x,
gfloat *  y,
int  cnt,
ColourLineSpec cls 
)
inline

Definition at line 274 of file Plot.H.

Here is the call graph for this function:

◆ plot() [4/6]

GtkDataboxGraph* Plot::plot ( gfloat *  x,
gfloat *  y1,
gfloat *  y2,
int  cnt 
)
inline

Plots the cnt y1 and y2 values at x to the axis This plot is a region of default colour

Parameters
xThe ordinates for plotting
y1The first co-ordinate for plotting
y2The second co-ordinate for plotting
cntThe number of elements to plot
Returns
the graph which was just added.

Definition at line 347 of file Plot.H.

◆ plot() [5/6]

GtkDataboxGraph* Plot::plot ( gfloat *  x,
gfloat *  y1,
gfloat *  y2,
int  cnt,
const char *  clsChar 
)
inline

Plots the cnt y1 and y2 values at x to the axis. This plot is a region of colour if a line plot is specified: e.g. clsChar="k" This plot is two dotted lines if a dotted plot is specified: e.g. clsChar="k:"

Parameters
xThe ordinates for plotting
y1The first co-ordinate for plotting
y2The second co-ordinate for plotting
cntThe number of elements to plot
clsCharThe specification to be used with the ColourLineSpec class
Returns
the graph which was just added.

Definition at line 362 of file Plot.H.

◆ plot() [6/6]

GtkDataboxGraph* Plot::plot ( gfloat *  x,
gfloat *  y1,
gfloat *  y2,
int  cnt,
ColourLineSpec cls 
)
inline

Plots the cnt y1 and y2 values at x to the axis This plot is a region of colour if a line plot is specified: e.g. cls="k" This plot are offset bars if a dotted plot is specified: e.g. cls="k:"

Parameters
xThe ordinates for plotting
y1The first co-ordinate for plotting
y2The second co-ordinate for plotting
cntThe number of elements to plot
clsThe ColourLineSpec class which determines the colour line type and size
Returns
the graph which was just added.

Definition at line 377 of file Plot.H.

Here is the call graph for this function:

◆ remove()

void Plot::remove ( GtkDataboxGraph *  toRemove)
inline

Remove a single line or text from the graph (unplot).

Parameters
toRemoveThe object to remove from the plot figure.

Definition at line 1001 of file Plot.H.

◆ replot()

void Plot::replot ( void  )
inline

Instruct gtk to replot If the underlying plot data pointers haven't changed, it is not necessary to call plot again. Simply call this method to get gtk to replot the contents of the data pointers used in the last call to Plot::plot.

Examples:
PlotTest2.C.

Definition at line 715 of file Plot.H.

◆ semilogx() [1/6]

GtkDataboxGraph* Plot::semilogx ( gfloat *  x,
gfloat *  y,
int  cnt 
)
inline

Plots with a logarithmic ordinate scale Plotting the data with a logarithmic ordinate scale and a default colour.

Parameters
xThe ordinates for plotting
yThe co-ordinates for plotting
cntThe number of elements to plot
Returns
the graph which was just added.

Definition at line 408 of file Plot.H.

◆ semilogx() [2/6]

GtkDataboxGraph* Plot::semilogx ( gfloat *  x,
gfloat *  y,
int  cnt,
const char *  clsChar 
)
inline

Plots with a logarithmic ordinate scale Plotting the data with a logarithmic ordinate scale.

Parameters
xThe ordinates for plotting
yThe co-ordinates for plotting
cntThe number of elements to plot
clsCharThe ColourLineSpec interpretable character array
Returns
the graph which was just added.

Definition at line 421 of file Plot.H.

◆ semilogx() [3/6]

GtkDataboxGraph* Plot::semilogx ( gfloat *  x,
gfloat *  y,
int  cnt,
ColourLineSpec cls 
)
inline

Plots with a logarithmic ordinate scale Plotting the data with a logarithmic ordinate scale.

Parameters
xThe ordinates for plotting
yThe co-ordinates for plotting
cntThe number of elements to plot
clsThe ColourLineSpec object to use for plotting
Returns
the graph which was just added.

Definition at line 434 of file Plot.H.

◆ semilogx() [4/6]

GtkDataboxGraph* Plot::semilogx ( gfloat *  x,
gfloat *  y1,
gfloat *  y2,
int  cnt 
)
inline

Plots with a logarithmic ordinate scale Plotting the data with a logarithmic ordinate scale and a default colour Each x ordinate has two y co-ordinates - resulting in offset bars.

Parameters
xThe ordinates for plotting
y1The co-ordinates for plotting
y2The co-ordinates for plotting
cntThe number of elements to plot
Returns
the graph which was just added.

Definition at line 449 of file Plot.H.

◆ semilogx() [5/6]

GtkDataboxGraph* Plot::semilogx ( gfloat *  x,
gfloat *  y1,
gfloat *  y2,
int  cnt,
const char *  clsChar 
)
inline

Plots with a logarithmic ordinate scale Plotting the data with a logarithmic ordinate scale and a default colour Each x ordinate has two y co-ordinates - resulting in solid regions if line plotting.

See also
plot where y1 and y2 are specified.
Parameters
xThe ordinates for plotting
y1The co-ordinates for plotting
y2The co-ordinates for plotting
cntThe number of elements to plot
clsCharThe ColourLineSpec interpretable character array
Returns
the graph which was just added.

Definition at line 465 of file Plot.H.

◆ semilogx() [6/6]

GtkDataboxGraph* Plot::semilogx ( gfloat *  x,
gfloat *  y1,
gfloat *  y2,
int  cnt,
ColourLineSpec cls 
)
inline

Plots with a logarithmic ordinate scale Plotting the data with a logarithmic ordinate scale and a default colour Each x ordinate has two y co-ordinates - resulting in solid regions if line plotting.

See also
plot where y1 and y2 are specified.
Parameters
xThe ordinates for plotting
y1The co-ordinates for plotting
y2The co-ordinates for plotting
cntThe number of elements to plot
clsThe ColourLineSpec object to use for plotting
Returns
the graph which was just added.

Definition at line 481 of file Plot.H.

◆ semilogy() [1/3]

GtkDataboxGraph* Plot::semilogy ( gfloat *  x,
gfloat *  y,
int  cnt 
)
inline

Plots with a logarithmic co-ordinate scale Plotting the data with a logarithmic co-ordinate scale and a default colour.

Parameters
xThe ordinates for plotting
yThe co-ordinates for plotting
cntThe number of elements to plot
Returns
the graph which was just added.

Definition at line 496 of file Plot.H.

◆ semilogy() [2/3]

GtkDataboxGraph* Plot::semilogy ( gfloat *  x,
gfloat *  y,
int  cnt,
const char *  clsChar 
)
inline

Plots with a logarithmic co-ordinate scale Plotting the data with a logarithmic co-ordinate scale.

Parameters
xThe ordinates for plotting
yThe co-ordinates for plotting
cntThe number of elements to plot
clsCharThe ColourLineSpec interpretable character array
Returns
the graph which was just added.

Definition at line 509 of file Plot.H.

◆ semilogy() [3/3]

GtkDataboxGraph* Plot::semilogy ( gfloat *  x,
gfloat *  y,
int  cnt,
ColourLineSpec cls 
)
inline

Plots with a logarithmic co-ordinate scale Plotting the data with a logarithmic co-ordinate scale.

Parameters
xThe ordinates for plotting
yThe co-ordinates for plotting
cntThe number of elements to plot
clsThe ColourLineSpec object to use for plotting
Returns
the graph which was just added.

Definition at line 522 of file Plot.H.

◆ set()

void Plot::set ( GtkWidget *  widget,
  ... 
)
inline

sets the property of the figure Various figure axis settings. This list of settings must be NULL terminated. Valid options are (either camel or lower case):

// For x-axis and y-axis linear/log scaling :
figure.set(figure.gca(), "YScale", "Log", NULL); // Y-axis has logarithmic scaling - similar for x-axis
figure.set(figure.gca(), "YScale", "Linear", NULL); // Y-axis has inear scaling - similar for x-axis (default when "Log" or "log" aren't found)
//Ticks
figure.set(figure.gca(), "XMinorTick", false, "YMinorTick", false, NULL); // don't (false) or do (true) show minor ticks on the axis rulers
figure.set(figure.gca(), "XTick", false, "YTick", false, NULL); // don't show ticks on the axis rulers
//Manual tick locations
int XCnt=5; gfloat xLocations[]= {500.0, 1000., 2000., 4000., 6000.};
int YCnt=5; float yLocations[]= {500.0, 1000., 2000., 4000., 6000.};
figure.set(figure.gca(), "XTick", XCnt, XLocations, "YTick", XCnt, XLocations, NULL); // show XCnt XTicks at XLocations, similar for Y
//Label formatting :
// NOTE: This uses printf style formatting commands. Must use %%.2f to represent %.2f internally.
figure.set(figure.gca(), "XLabelFormat", "%%.2f", NULL); // print two digits after the decimal point in this case
// NOTE: in scientific mode, the end of the label is cropped, so change the max length like so :
figure.set(figure.gca(), "XLabelFormat", "%%.2e", NULL); // scientific mode with two digits after the decimal point
figure.set(figure.gca(), "XLabelLength", 9, NULL); // allow longer x tick labels so the end of the scientific notation doesn't get cropped.
//Manual labels (at tick locations) :
gchar *xLabels[]= {(gchar*)"These",(gchar*)"are",(gchar*)"manually",(gchar*)"placed", (gchar*)"labels"};
figure.set(figure.gca(), "XTickLabel", xLabels, NULL); // Manual labels at tick locations, similar for Y
// Current cursor positions : Whether to draw the arrows in the rulers which indicate the current cursor position.
figure.set(figure.gca(), "XPosition", false, "YPosition", true, NULL); // Don't draw x arrow positions, but draw y arrow potitions.
// Shift the ticks left or right : moves the tick labels left or right by this number of pixels.
figure.set(figure.gca(), "XTickXOffset", 10, "YTickXOffset", 3, NULL); // Shift the tick labels left 10 pixels on the X axis and 3 on the y axis.
// Vertical or horizontal label rotations
figure.set(figure.gca(), "YLabelRotate", "Vertical", NULL); // Draw Y labels vertically. Similar for x.
figure.set(figure.gca(), "YLabelRotate", "Horizontal", NULL); // Draw Y labels horizontally. Similar for x.
// For vertical rulers with horizontal text, label alignment
figure.set(figure.gca(), "YLabelAlignment", "Right", NULL); // Draw Y labels right adjusted - if the y-axis has horizontal text
figure.set(figure.gca(), "YLabelAlignment", "center", NULL); // Draw Y labels centrally - if the y-axis has horizontal text
// Label maximum lengths : Maximum length (digits or chars) of tick labels
figure.set(figure.gca(), "XLabelLength", 3, NULL); // Draw Y labels horizontally. With a maximum length of 3 chars
// Axis edge shadow : How to render the edge axis shadows
// GTK_SHADOW_NONE=0
// GTK_SHADOW_IN=1
// GTK_SHADOW_OUT=2
// GTK_SHADOW_ETCHED_IN=3
// GTK_SHADOW_ETCHED_OUT=4
figure.set(figure.gca(), "XShadow", GTK_SHADOW_IN, "YShadow", GTK_SHADOW_OUT, NULL); // Draw inward box shadow for X and outwards box shadow for Y
// Main plotting box edge shadow : How to render the edge axis shadows
figure.set(figure.gca(), "BoxShadow", GTK_SHADOW_OUT, NULL); // Draw a box around the main plotting window

In general, all properties, are specified for both X and Y axes.

Examples:
PlotTest2.C.

Definition at line 780 of file Plot.H.

◆ setBackground() [1/3]

void Plot::setBackground ( const char *  clsStr)
inline

Set the background a particular colour.

Parameters
clsStrThe colour to set the background to.

Definition at line 163 of file Plot.H.

◆ setBackground() [2/3]

void Plot::setBackground ( ColourLineSpec  cls)
inline

Set the background a particular colour.

Parameters
clsThe colour to set the background to.

Definition at line 170 of file Plot.H.

Here is the call graph for this function:

◆ setBackground() [3/3]

void Plot::setBackground ( const GdkColor  gdkC)
inline

Set the background a particular colour.

Parameters
gdkCThe colour to set the background to.

Definition at line 186 of file Plot.H.

◆ show()

void Plot::show ( void  )
inline

A method to show all of the rulers and graphs

Examples:
PlotTest2.C.

Definition at line 207 of file Plot.H.

◆ text() [1/2]

GtkDataboxGraph* Plot::text ( gfloat *  x,
gfloat *  y,
const char *  textDisp,
const char *  clsChar 
)
inline

Displays text at an x and y location, with a specified colour

Parameters
xThe ordinate to place the text at
yThe co-ordinate to place the text at
textDispThe text to display
clsCharThe specification to be used with the ColourLineSpec class
Examples:
PlotTest2.C.

Definition at line 578 of file Plot.H.

◆ text() [2/2]

GtkDataboxGraph* Plot::text ( gfloat *  x,
gfloat *  y,
const char *  textDisp,
ColourLineSpec cls 
)
inline

Displays text at an x and y location, with a specified colour

Parameters
xThe ordinate to place the text at
yThe co-ordinate to place the text at
textDispThe text to display
clsThe colour of the text
Returns
graph which is the added label

Definition at line 590 of file Plot.H.

Here is the call graph for this function:

◆ title() [1/2]

void Plot::title ( const char *  titleStr,
int *  indexes = NULL 
)
inline

Set a title, by default the title is placed above the plot By changing the indexes, it can be placed in any table cell.

See also
xLabel, yLabel
Parameters
titleStrThe title to display
indexesThe table cell to place the label in
Examples:
PlotTest2.C.

Definition at line 965 of file Plot.H.

Here is the call graph for this function:

◆ title() [2/2]

void Plot::title ( GtkWidget *  widget,
int *  indexes = NULL 
)
inline

Set a title, by default the title is placed above the plot By changing the indexes, it can be placed in any table cell.

See also
xLabel, yLabel
Parameters
widgetThe title to display which is expected to be a label widget
indexesThe table cell to place the label in

Definition at line 979 of file Plot.H.

◆ xLabel()

void Plot::xLabel ( const char *  label,
int *  indexes = NULL 
)
inline

Set an xlabel, by default the labels is placed below the plot. By changing the indexes, it can be placed in any table cell. For example this places it in the bottom left (same as xLabelBL) :

int indexes[]={1,2,2,3};
xLabel("bottom left",indexes);
Parameters
labelThe label to display
indexesThe table cell to place the label in
Examples:
PlotTest2.C.

Definition at line 905 of file Plot.H.

◆ xLabelBL()

void Plot::xLabelBL ( const char *  label)
inline

Set an xlabel in the bottom left location (below the yaxis)

Parameters
labelThe label to display

Definition at line 918 of file Plot.H.

◆ yLabel()

void Plot::yLabel ( const char *  label,
int *  indexes = NULL 
)
inline

Set a ylabel, by default the label is placed left of the plot. By changing the indexes, it can be placed in any table cell. For example this places it in the top left (same as yLabelTL) :

int indexes[]={1,2,0,1};
yLabel("top left",indexes);
Parameters
labelThe label to display
indexesThe table cell to place the label in
Examples:
PlotTest2.C.

Definition at line 935 of file Plot.H.

Here is the call graph for this function:

◆ yLabelTL()

void Plot::yLabelTL ( const char *  label)
inline

Set a ylabel, by default the label is placed top left of the plot.

Parameters
labelThe label to display

Definition at line 952 of file Plot.H.

Member Data Documentation

◆ axis

GtkWidget* Plot::axis
protected

The axis widget.

Definition at line 120 of file Plot.H.

◆ gridGraph

GtkDataboxGraph* Plot::gridGraph
protected

The grid which defaults to off.

Definition at line 121 of file Plot.H.

◆ gridOn

bool Plot::gridOn
protected

Whether to the grid is on.

Definition at line 123 of file Plot.H.

◆ holdOn

bool Plot::holdOn
protected

Whether to hold the curves or not.

Definition at line 122 of file Plot.H.


The documentation for this class was generated from the following file:
gtkIOStream: Plot Class Reference
GTK+ IOStream  Beta