Bayeux  3.4.1
Core Foundation library for SuperNEMO
Public Member Functions | Static Public Member Functions | List of all members
Gnuplot Class Reference

#include <bayeux/geomtools/gnuplot_i.h>

Public Member Functions

 Gnuplot (const std::string &style="points")
 set a style during construction More...
 
 Gnuplot (const std::vector< double > &x, const std::string &title="", const std::string &style="points", const std::string &labelx="x", const std::string &labely="y")
 plot a single std::vector at one go More...
 
 Gnuplot (const std::vector< double > &x, const std::vector< double > &y, const std::string &title="", const std::string &style="points", const std::string &labelx="x", const std::string &labely="y")
 plot pairs std::vector at one go More...
 
 Gnuplot (const std::vector< double > &x, const std::vector< double > &y, const std::vector< double > &z, const std::string &title="", const std::string &style="points", const std::string &labelx="x", const std::string &labely="y", const std::string &labelz="z")
 plot triples std::vector at one go More...
 
 ~Gnuplot ()
 destructor: needed to delete temporary files More...
 
bool has_terminal () const
 Check if terminal is set. More...
 
void set_terminal (const std::string &terminal_)
 Set the active terminal. More...
 
const std::string & get_terminal () const
 Return the active terminal type. More...
 
Gnuplotcmd (const std::string &cmdstr)
 send a command to gnuplot More...
 
Gnuplotoperator<< (const std::string &cmdstr)
 Sends a command to an active gnuplot session, identical to cmd () send a command to gnuplot using the << operator. More...
 
Gnuplotshowonscreen ()
 
Gnuplotsavetops (const std::string &filename="gnuplot_output")
 saves a gnuplot session to a postscript file, filename without extension More...
 
Gnuplotset_style (const std::string &stylestr="points")
 
Gnuplotset_smooth (const std::string &stylestr="csplines")
 
Gnuplotunset_smooth ()
 unset smooth attention: smooth is not set by default More...
 
Gnuplotset_pointsize (const double pointsize=1.0)
 scales the size of the points used in plots More...
 
Gnuplotset_grid ()
 turns grid on/off More...
 
Gnuplotunset_grid ()
 grid is not set by default More...
 
Gnuplotset_multiplot ()
 
Gnuplotunset_multiplot ()
 
Gnuplotset_samples (const int samples=100)
 set sampling rate of functions, or for interpolating data More...
 
Gnuplotset_isosamples (const int isolines=10)
 set isoline density (grid) for plotting functions as surfaces (for 3d plots) More...
 
Gnuplotset_hidden3d ()
 
Gnuplotunset_hidden3d ()
 
Gnuplotset_contour (const std::string &position="base")
 
Gnuplotunset_contour ()
 
Gnuplotset_surface ()
 
Gnuplotunset_surface ()
 
Gnuplotset_legend (const std::string &position="default")
 
Gnuplotunset_legend ()
 Switches legend off attention:legend is set by default. More...
 
Gnuplotset_title (const std::string &title="")
 sets and clears the title of a gnuplot session More...
 
Gnuplotunset_title ()
 Clears the title of a gnuplot session The title is not set by default. More...
 
Gnuplotset_ylabel (const std::string &label="x")
 set x axis label More...
 
Gnuplotset_xlabel (const std::string &label="y")
 set y axis label More...
 
Gnuplotset_zlabel (const std::string &label="z")
 set z axis label More...
 
Gnuplotset_xrange (const double iFrom, const double iTo)
 set axis - ranges More...
 
Gnuplotset_yrange (const double iFrom, const double iTo)
 set y-axis - ranges More...
 
Gnuplotset_zrange (const double iFrom, const double iTo)
 set z-axis - ranges More...
 
Gnuplotset_xautoscale ()
 
Gnuplotset_yautoscale ()
 
Gnuplotset_zautoscale ()
 
Gnuplotset_xlogscale (const double base=10)
 turns on/off log scaling for the specified xaxis (logscale is not set by default) More...
 
Gnuplotset_ylogscale (const double base=10)
 turns on/off log scaling for the specified yaxis (logscale is not set by default) More...
 
Gnuplotset_zlogscale (const double base=10)
 turns on/off log scaling for the specified zaxis (logscale is not set by default) More...
 
Gnuplotunset_xlogscale ()
 
Gnuplotunset_ylogscale ()
 
Gnuplotunset_zlogscale ()
 
Gnuplotset_cbrange (const double iFrom, const double iTo)
 set palette range (autoscale by default) More...
 
Gnuplotplotfile_x (const std::string &filename, const unsigned int column=1, const std::string &title="")
 
template<typename X >
Gnuplotplot_x (const X &x, const std::string &title="")
 from std::vector More...
 
Gnuplotplotfile_xy (const std::string &filename, const unsigned int column_x=1, const unsigned int column_y=2, const std::string &title="")
 
Gnuplotplotfile_xy (const std::string &filename, const unsigned int column_x, const unsigned int column_y, const std::string &title, const std::string &file_options_, const std::string &plot_options_)
 
template<typename X , typename Y >
Gnuplotplot_xy (const X &x, const Y &y, const std::string &title="")
 from data More...
 
Gnuplotplotfile_xy_err (const std::string &filename, const unsigned int column_x=1, const unsigned int column_y=2, const unsigned int column_dy=3, const std::string &title="")
 
template<typename X , typename Y , typename E >
Gnuplotplot_xy_err (const X &x, const Y &y, const E &dy, const std::string &title="")
 from data More...
 
Gnuplotplotfile_xyz (const std::string &filename, const unsigned int column_x=1, const unsigned int column_y=2, const unsigned int column_z=3, const std::string &title="")
 
Gnuplotplotfile_xyzo (const std::string &filename, const unsigned int column_x=1, const unsigned int column_y=2, const unsigned int column_z=3, const unsigned int column_o=4, const std::string &title="")
 
Gnuplotplotfile_xyz_with_colored_wires (const std::string &filename, const std::string &title="", int color_=0)
 
template<typename X , typename Y , typename Z >
Gnuplotplot_xyz (const X &x, const Y &y, const Z &z, const std::string &title="")
 from std::vector More...
 
Gnuplotplot_slope (const double a, const double b, const std::string &title="")
 plot an equation of the form: y = ax + b, you supply a and b More...
 
Gnuplotplot_equation (const std::string &equation, const std::string &title="")
 
Gnuplotplot_equation3d (const std::string &equation, const std::string &title="")
 
Gnuplotplot_image (const unsigned char *ucPicBuf, const unsigned int iWidth, const unsigned int iHeight, const std::string &title="")
 plot image More...
 
Gnuplotreplot (void)
 replot repeats the last plot or splot command. this can be useful for viewing a plot with different set options, or when generating the same plot for several devices (showonscreen, savetops) More...
 
Gnuplotreset_plot ()
 resets a gnuplot session (next plot will erase previous ones) More...
 
Gnuplotreset_all ()
 resets a gnuplot session and sets all variables to default More...
 
void remove_tmpfiles ()
 deletes temporary files More...
 
bool is_valid ()
 Is the gnuplot session valid ?? More...
 

Static Public Member Functions

static const std::string & terminal_std ()
 Return the default terminal type on the current system. More...
 
static bool set_gnuplot_path (const std::string &path)
 optional function: set Gnuplot path manual attention: for windows: path with slash '/' not backslash '\' More...
 
static void set_terminal_std (const std::string &type)
 

Constructor & Destructor Documentation

◆ Gnuplot() [1/4]

Gnuplot::Gnuplot ( const std::string &  style = "points")

set a style during construction

◆ Gnuplot() [2/4]

Gnuplot::Gnuplot ( const std::vector< double > &  x,
const std::string &  title = "",
const std::string &  style = "points",
const std::string &  labelx = "x",
const std::string &  labely = "y" 
)

plot a single std::vector at one go

◆ Gnuplot() [3/4]

Gnuplot::Gnuplot ( const std::vector< double > &  x,
const std::vector< double > &  y,
const std::string &  title = "",
const std::string &  style = "points",
const std::string &  labelx = "x",
const std::string &  labely = "y" 
)

plot pairs std::vector at one go

◆ Gnuplot() [4/4]

Gnuplot::Gnuplot ( const std::vector< double > &  x,
const std::vector< double > &  y,
const std::vector< double > &  z,
const std::string &  title = "",
const std::string &  style = "points",
const std::string &  labelx = "x",
const std::string &  labely = "y",
const std::string &  labelz = "z" 
)

plot triples std::vector at one go

◆ ~Gnuplot()

Gnuplot::~Gnuplot ( )

destructor: needed to delete temporary files

Member Function Documentation

◆ cmd()

Gnuplot& Gnuplot::cmd ( const std::string &  cmdstr)

send a command to gnuplot

◆ get_terminal()

const std::string& Gnuplot::get_terminal ( ) const

Return the active terminal type.

◆ has_terminal()

bool Gnuplot::has_terminal ( ) const

Check if terminal is set.

◆ is_valid()

bool Gnuplot::is_valid ( )
inline

Is the gnuplot session valid ??

Returns
true if valid, false if not

◆ operator<<()

Gnuplot& Gnuplot::operator<< ( const std::string &  cmdstr)
inline

Sends a command to an active gnuplot session, identical to cmd () send a command to gnuplot using the << operator.

Parameters
cmdstr--> the command string
Returns
<– a reference to the gnuplot object

◆ plot_equation()

Gnuplot& Gnuplot::plot_equation ( const std::string &  equation,
const std::string &  title = "" 
)

plot an equation supplied as a std::string y=f (x), write only the function f (x) not y= the independent variable has to be x binary operators: ** exponentiation, * multiply, / divide, + add, - substract, % modulo unary operators: - minus, ! factorial elementary functions: rand (x), abs (x), sgn (x), ceil (x), floor (x), int (x), imag (x), real (x), arg (x), sqrt (x), exp (x), log (x), log10 (x), sin (x), cos (x), tan (x), asin (x), acos (x), atan (x), atan2 (y,x), sinh (x), cosh (x), tanh (x), asinh (x), acosh (x), atanh (x) special functions: erf (x), erfc (x), inverf (x), gamma (x), igamma (a,x), lgamma (x), ibeta (p,q,x), besj0 (x), besj1 (x), besy0 (x), besy1 (x), lambertw (x) statistical fuctions: norm (x), invnorm (x)

◆ plot_equation3d()

Gnuplot& Gnuplot::plot_equation3d ( const std::string &  equation,
const std::string &  title = "" 
)

plot an equation supplied as a std::string z=f (x,y), write only the function f (x,y) not z= the independent variables have to be x and y

◆ plot_image()

Gnuplot& Gnuplot::plot_image ( const unsigned char *  ucPicBuf,
const unsigned int  iWidth,
const unsigned int  iHeight,
const std::string &  title = "" 
)

plot image

◆ plot_slope()

Gnuplot& Gnuplot::plot_slope ( const double  a,
const double  b,
const std::string &  title = "" 
)

plot an equation of the form: y = ax + b, you supply a and b

◆ plot_x()

template<typename X >
Gnuplot& Gnuplot::plot_x ( const X &  x,
const std::string &  title = "" 
)
inline

from std::vector

Plots a 2d graph from a list of doubles: x

◆ plot_xy()

template<typename X , typename Y >
Gnuplot& Gnuplot::plot_xy ( const X &  x,
const Y &  y,
const std::string &  title = "" 
)
inline

from data

Plots a 2d graph from a list of doubles: x y

◆ plot_xy_err()

template<typename X , typename Y , typename E >
Gnuplot& Gnuplot::plot_xy_err ( const X &  x,
const Y &  y,
const E &  dy,
const std::string &  title = "" 
)
inline

from data


plot x,y pairs with dy errorbars

◆ plot_xyz()

template<typename X , typename Y , typename Z >
Gnuplot& Gnuplot::plot_xyz ( const X &  x,
const Y &  y,
const Z &  z,
const std::string &  title = "" 
)
inline

from std::vector

◆ plotfile_x()

Gnuplot& Gnuplot::plotfile_x ( const std::string &  filename,
const unsigned int  column = 1,
const std::string &  title = "" 
)

plot a single std::vector: x from file

◆ plotfile_xy() [1/2]

Gnuplot& Gnuplot::plotfile_xy ( const std::string &  filename,
const unsigned int  column_x = 1,
const unsigned int  column_y = 2,
const std::string &  title = "" 
)

plot x,y pairs: x y from file

◆ plotfile_xy() [2/2]

Gnuplot& Gnuplot::plotfile_xy ( const std::string &  filename,
const unsigned int  column_x,
const unsigned int  column_y,
const std::string &  title,
const std::string &  file_options_,
const std::string &  plot_options_ 
)

◆ plotfile_xy_err()

Gnuplot& Gnuplot::plotfile_xy_err ( const std::string &  filename,
const unsigned int  column_x = 1,
const unsigned int  column_y = 2,
const unsigned int  column_dy = 3,
const std::string &  title = "" 
)

plot x,y pairs with dy errorbars: x y dy from file

◆ plotfile_xyz()

Gnuplot& Gnuplot::plotfile_xyz ( const std::string &  filename,
const unsigned int  column_x = 1,
const unsigned int  column_y = 2,
const unsigned int  column_z = 3,
const std::string &  title = "" 
)

plot x,y,z triples: x y z from file

◆ plotfile_xyz_with_colored_wires()

Gnuplot& Gnuplot::plotfile_xyz_with_colored_wires ( const std::string &  filename,
const std::string &  title = "",
int  color_ = 0 
)

◆ plotfile_xyzo()

Gnuplot& Gnuplot::plotfile_xyzo ( const std::string &  filename,
const unsigned int  column_x = 1,
const unsigned int  column_y = 2,
const unsigned int  column_z = 3,
const unsigned int  column_o = 4,
const std::string &  title = "" 
)

◆ remove_tmpfiles()

void Gnuplot::remove_tmpfiles ( )

deletes temporary files

◆ replot()

Gnuplot& Gnuplot::replot ( void  )
inline

replot repeats the last plot or splot command. this can be useful for viewing a plot with different set options, or when generating the same plot for several devices (showonscreen, savetops)

Returns

◆ reset_all()

Gnuplot& Gnuplot::reset_all ( )

resets a gnuplot session and sets all variables to default

◆ reset_plot()

Gnuplot& Gnuplot::reset_plot ( )

resets a gnuplot session (next plot will erase previous ones)

◆ savetops()

Gnuplot& Gnuplot::savetops ( const std::string &  filename = "gnuplot_output")

saves a gnuplot session to a postscript file, filename without extension

◆ set_cbrange()

Gnuplot& Gnuplot::set_cbrange ( const double  iFrom,
const double  iTo 
)

set palette range (autoscale by default)

◆ set_contour()

Gnuplot& Gnuplot::set_contour ( const std::string &  position = "base")

enables/disables contour drawing for surfaces (for 3d plot) base, surface, both

◆ set_gnuplot_path()

static bool Gnuplot::set_gnuplot_path ( const std::string &  path)
static

optional function: set Gnuplot path manual attention: for windows: path with slash '/' not backslash '\'

Parameters
path--> the gnuplot path
Returns
true on success, false otherwise

◆ set_grid()

Gnuplot& Gnuplot::set_grid ( )
inline

turns grid on/off

◆ set_hidden3d()

Gnuplot& Gnuplot::set_hidden3d ( )
inline

enables/disables hidden line removal for surface plotting (for 3d plot)

Returns
<– reference to the gnuplot object

◆ set_isosamples()

Gnuplot& Gnuplot::set_isosamples ( const int  isolines = 10)

set isoline density (grid) for plotting functions as surfaces (for 3d plots)

◆ set_legend()

Gnuplot& Gnuplot::set_legend ( const std::string &  position = "default")

switches legend on/off position: inside/outside, left/center/right, top/center/bottom, nobox/box

◆ set_multiplot()

Gnuplot& Gnuplot::set_multiplot ( )
inline

set the mulitplot mode

Returns
<– reference to the gnuplot object

◆ set_pointsize()

Gnuplot& Gnuplot::set_pointsize ( const double  pointsize = 1.0)

scales the size of the points used in plots

◆ set_samples()

Gnuplot& Gnuplot::set_samples ( const int  samples = 100)

set sampling rate of functions, or for interpolating data

◆ set_smooth()

Gnuplot& Gnuplot::set_smooth ( const std::string &  stylestr = "csplines")

interpolation and approximation of data, arguments: csplines, bezier, acsplines (for data values > 0), sbezier, unique, frequency (works only with plot_x, plot_xy, plotfile_x, plotfile_xy (if smooth is set, set_style has no effekt on data plotting)

◆ set_style()

Gnuplot& Gnuplot::set_style ( const std::string &  stylestr = "points")

set line style (some of these styles require additional information): lines, points, linespoints, impulses, dots, steps, fsteps, histeps, boxes, histograms, filledcurves

◆ set_surface()

Gnuplot& Gnuplot::set_surface ( )
inline

enables/disables the display of surfaces (for 3d plot)

Returns
<– reference to the gnuplot object

◆ set_terminal()

void Gnuplot::set_terminal ( const std::string &  terminal_)

Set the active terminal.

◆ set_terminal_std()

static void Gnuplot::set_terminal_std ( const std::string &  type)
static

optional: set standart terminal, used by showonscreen defaults: Windows - win, Linux - x11, Mac - aqua

Parameters
type--> the terminal type
Returns

◆ set_title()

Gnuplot& Gnuplot::set_title ( const std::string &  title = "")
inline

sets and clears the title of a gnuplot session

Parameters
title--> the title of the plot [optional, default == ""]
Returns
<– reference to the gnuplot object

◆ set_xautoscale()

Gnuplot& Gnuplot::set_xautoscale ( )
inline

autoscale axis (set by default) of xaxis

Returns
<– reference to the gnuplot object

◆ set_xlabel()

Gnuplot& Gnuplot::set_xlabel ( const std::string &  label = "y")

set y axis label

◆ set_xlogscale()

Gnuplot& Gnuplot::set_xlogscale ( const double  base = 10)

turns on/off log scaling for the specified xaxis (logscale is not set by default)

◆ set_xrange()

Gnuplot& Gnuplot::set_xrange ( const double  iFrom,
const double  iTo 
)

set axis - ranges

◆ set_yautoscale()

Gnuplot& Gnuplot::set_yautoscale ( )
inline

autoscale axis (set by default) of yaxis

Returns
<– reference to the gnuplot object

◆ set_ylabel()

Gnuplot& Gnuplot::set_ylabel ( const std::string &  label = "x")

set x axis label

◆ set_ylogscale()

Gnuplot& Gnuplot::set_ylogscale ( const double  base = 10)

turns on/off log scaling for the specified yaxis (logscale is not set by default)

◆ set_yrange()

Gnuplot& Gnuplot::set_yrange ( const double  iFrom,
const double  iTo 
)

set y-axis - ranges

◆ set_zautoscale()

Gnuplot& Gnuplot::set_zautoscale ( )
inline

autoscale axis (set by default) of zaxis

Returns
<– reference to the gnuplot object

◆ set_zlabel()

Gnuplot& Gnuplot::set_zlabel ( const std::string &  label = "z")

set z axis label

◆ set_zlogscale()

Gnuplot& Gnuplot::set_zlogscale ( const double  base = 10)

turns on/off log scaling for the specified zaxis (logscale is not set by default)

◆ set_zrange()

Gnuplot& Gnuplot::set_zrange ( const double  iFrom,
const double  iTo 
)

set z-axis - ranges

◆ showonscreen()

Gnuplot& Gnuplot::showonscreen ( )

sets terminal type to terminal (default to Gnuplot::g_terminal_std) window output is set by default (win/x11/aqua)

◆ terminal_std()

static const std::string& Gnuplot::terminal_std ( )
static

Return the default terminal type on the current system.

◆ unset_contour()

Gnuplot& Gnuplot::unset_contour ( )
inline

contour is not set by default, it disables contour drawing for surfaces

Returns
<– reference to the gnuplot object

◆ unset_grid()

Gnuplot& Gnuplot::unset_grid ( )
inline

grid is not set by default

◆ unset_hidden3d()

Gnuplot& Gnuplot::unset_hidden3d ( )
inline

hidden3d is not set by default

Returns
<– reference to the gnuplot object

◆ unset_legend()

Gnuplot& Gnuplot::unset_legend ( )
inline

Switches legend off attention:legend is set by default.

Returns
<– reference to the gnuplot object

◆ unset_multiplot()

Gnuplot& Gnuplot::unset_multiplot ( )
inline

unsets the mulitplot mode

Returns
<– reference to the gnuplot object

◆ unset_smooth()

Gnuplot& Gnuplot::unset_smooth ( )
inline

unset smooth attention: smooth is not set by default

Returns
<– a reference to a gnuplot object

◆ unset_surface()

Gnuplot& Gnuplot::unset_surface ( )
inline

surface is set by default, it disables the display of surfaces (for 3d plot)

Returns
<– reference to the gnuplot object

◆ unset_title()

Gnuplot& Gnuplot::unset_title ( )
inline

Clears the title of a gnuplot session The title is not set by default.

Returns
<– reference to the gnuplot object

◆ unset_xlogscale()

Gnuplot& Gnuplot::unset_xlogscale ( )
inline

turns off log scaling for the x axis

Returns
<– reference to the gnuplot object

◆ unset_ylogscale()

Gnuplot& Gnuplot::unset_ylogscale ( )
inline

turns off log scaling for the y axis

Returns
<– reference to the gnuplot object

◆ unset_zlogscale()

Gnuplot& Gnuplot::unset_zlogscale ( )
inline

turns off log scaling for the z axis

Returns
<– reference to the gnuplot object

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