3.5-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
Public Types | Public Member Functions | List of all members
Dumux::GnuplotInterface< Scalar > Class Template Reference

Interface for passing data sets to a file and plotting them, if gnuplot is installed. More...

#include <dumux/io/gnuplotinterface.hh>

Description

template<class Scalar>
class Dumux::GnuplotInterface< Scalar >

Interface for passing data sets to a file and plotting them, if gnuplot is installed.

Public Types

enum class  CurveType { function , file , data }
 
using StringVector = std::vector< std::string >
 
using CurveTypeVector = std::vector< CurveType >
 

Public Member Functions

 GnuplotInterface (bool persist=true)
 The constructor. More...
 
 ~GnuplotInterface ()
 The destructor. More...
 
void plot (const std::string &filename="")
 Plots the files for a specific window number, writes a gnuplot and png file. More...
 
void resetAll (const bool persist=true)
 Resets all gnuplot parameters. More...
 
void resetPlot ()
 Deletes all plots from a plotting window and resets user-defined options. More...
 
void open (const bool persist=true)
 Opens gnuplot. More...
 
void close ()
 Closes gnuplot. More...
 
void addFunctionToPlot (const std::string &function, const std::string &options="with lines")
 Adds a function to list of plots. More...
 
void addFileToPlot (const std::string &fileName, const std::string &options="with lines")
 Adds a file to list of plots. More...
 
void addDataSetToPlot (const std::vector< Scalar > &x, const std::vector< Scalar > &y, const std::string &fileName, const std::string &options="with lines")
 Adds a data set and writes a data file. More...
 
void setXlabel (const std::string &label)
 Sets the label for the x-axis. More...
 
void setYlabel (const std::string &label)
 Sets the label for the y-axis. More...
 
void setXRange (Scalar min, Scalar max)
 Sets the range for the x-axis. More...
 
void setYRange (Scalar min, Scalar max)
 Sets the range for the y-axis. More...
 
void setOption (const std::string &option)
 Sets additional user-defined options. More...
 
void setOpenPlotWindow (bool openPlotWindow)
 Define whether the gnuplot window should be opened. More...
 
void setCreateImage (bool createImage)
 Define whether gnuplot should create .png files. More...
 
void setDatafileSeparator (char separator)
 Sets the datafile separator. More...
 
void setTerminalType (std::string terminal)
 Sets the terminal used for interactive outpu. More...
 
void setOutputDirectory (const std::string &outputDirectory)
 Sets the output directory for data and gnuplot files. More...
 
void useDashedLines (bool dashed)
 Use dashed (true) or solid (false) lines. More...
 

Member Typedef Documentation

◆ CurveTypeVector

template<class Scalar >
using Dumux::GnuplotInterface< Scalar >::CurveTypeVector = std::vector<CurveType>

◆ StringVector

template<class Scalar >
using Dumux::GnuplotInterface< Scalar >::StringVector = std::vector<std::string>

Member Enumeration Documentation

◆ CurveType

template<class Scalar >
enum class Dumux::GnuplotInterface::CurveType
strong
Enumerator
function 
file 
data 

Constructor & Destructor Documentation

◆ GnuplotInterface()

template<class Scalar >
Dumux::GnuplotInterface< Scalar >::GnuplotInterface ( bool  persist = true)
inlineexplicit

The constructor.

◆ ~GnuplotInterface()

template<class Scalar >
Dumux::GnuplotInterface< Scalar >::~GnuplotInterface ( )
inline

The destructor.

Member Function Documentation

◆ addDataSetToPlot()

template<class Scalar >
void Dumux::GnuplotInterface< Scalar >::addDataSetToPlot ( const std::vector< Scalar > &  x,
const std::vector< Scalar > &  y,
const std::string &  fileName,
const std::string &  options = "with lines" 
)
inline

Adds a data set and writes a data file.

The title of the plot can be changed by setting the title in the options

Parameters
xVector containing the x-axis data points
yVector containing the y-axis data points
fileNameThe name of the written data file
optionsSpecific gnuplot options passed to this plot

◆ addFileToPlot()

template<class Scalar >
void Dumux::GnuplotInterface< Scalar >::addFileToPlot ( const std::string &  fileName,
const std::string &  options = "with lines" 
)
inline

Adds a file to list of plots.

Parameters
fileNameName and path of the file to be plotted
optionsSpecific gnuplot options passed to this plot

◆ addFunctionToPlot()

template<class Scalar >
void Dumux::GnuplotInterface< Scalar >::addFunctionToPlot ( const std::string &  function,
const std::string &  options = "with lines" 
)
inline

Adds a function to list of plots.

Parameters
functionFunction to be plotted
optionsSpecific gnuplot options passed to this plot

◆ close()

template<class Scalar >
void Dumux::GnuplotInterface< Scalar >::close ( )
inline

Closes gnuplot.

◆ open()

template<class Scalar >
void Dumux::GnuplotInterface< Scalar >::open ( const bool  persist = true)
inline

Opens gnuplot.

◆ plot()

template<class Scalar >
void Dumux::GnuplotInterface< Scalar >::plot ( const std::string &  filename = "")
inline

Plots the files for a specific window number, writes a gnuplot and png file.

Parameters
filenameThe name of the output file

◆ resetAll()

template<class Scalar >
void Dumux::GnuplotInterface< Scalar >::resetAll ( const bool  persist = true)
inline

Resets all gnuplot parameters.

◆ resetPlot()

template<class Scalar >
void Dumux::GnuplotInterface< Scalar >::resetPlot ( )
inline

Deletes all plots from a plotting window and resets user-defined options.

◆ setCreateImage()

template<class Scalar >
void Dumux::GnuplotInterface< Scalar >::setCreateImage ( bool  createImage)
inline

Define whether gnuplot should create .png files.

Parameters
createImageCreate an image or not

◆ setDatafileSeparator()

template<class Scalar >
void Dumux::GnuplotInterface< Scalar >::setDatafileSeparator ( char  separator)
inline

Sets the datafile separator.

Parameters
separatorThe separator sign between two data columns

◆ setOpenPlotWindow()

template<class Scalar >
void Dumux::GnuplotInterface< Scalar >::setOpenPlotWindow ( bool  openPlotWindow)
inline

Define whether the gnuplot window should be opened.

Parameters
openPlotWindowOpen gnuplot or not

◆ setOption()

template<class Scalar >
void Dumux::GnuplotInterface< Scalar >::setOption ( const std::string &  option)
inline

Sets additional user-defined options.

Parameters
optionAdditional line of option in gnuplot language

◆ setOutputDirectory()

template<class Scalar >
void Dumux::GnuplotInterface< Scalar >::setOutputDirectory ( const std::string &  outputDirectory)
inline

Sets the output directory for data and gnuplot files.

Parameters
outputDirectoryThe user-specified terminal

◆ setTerminalType()

template<class Scalar >
void Dumux::GnuplotInterface< Scalar >::setTerminalType ( std::string  terminal)
inline

Sets the terminal used for interactive outpu.

Parameters
terminalThe user-specified terminal

◆ setXlabel()

template<class Scalar >
void Dumux::GnuplotInterface< Scalar >::setXlabel ( const std::string &  label)
inline

Sets the label for the x-axis.

Parameters
labelThe label of the x-axis

◆ setXRange()

template<class Scalar >
void Dumux::GnuplotInterface< Scalar >::setXRange ( Scalar  min,
Scalar  max 
)
inline

Sets the range for the x-axis.

Parameters
minThe lowest plotted value for the x-axis
maxThe highest plotted value for the x-axis

◆ setYlabel()

template<class Scalar >
void Dumux::GnuplotInterface< Scalar >::setYlabel ( const std::string &  label)
inline

Sets the label for the y-axis.

Parameters
labelThe label of the y-axis

◆ setYRange()

template<class Scalar >
void Dumux::GnuplotInterface< Scalar >::setYRange ( Scalar  min,
Scalar  max 
)
inline

Sets the range for the y-axis.

Parameters
minThe lowest plotted value for the y-axis
maxThe highest plotted value for the y-axis

◆ useDashedLines()

template<class Scalar >
void Dumux::GnuplotInterface< Scalar >::useDashedLines ( bool  dashed)
inline

Use dashed (true) or solid (false) lines.

Parameters
dashedUse dashed lines

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