version 3.8
Dumux::GnuplotInterface< Scalar > Class Template Reference

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

#include <dumux/io/gnuplotinterface.hh>

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 output. 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

◆ ~GnuplotInterface()

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

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

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
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
Parameters
functionFunction to be plotted
optionsSpecific gnuplot options passed to this plot

◆ close()

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

◆ open()

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

◆ plot()

template<class Scalar >
void Dumux::GnuplotInterface< Scalar >::plot ( const std::string &  filename = "")
inline
Parameters
filenameThe name of the output file

◆ resetAll()

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

◆ resetPlot()

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

◆ setCreateImage()

template<class Scalar >
void Dumux::GnuplotInterface< Scalar >::setCreateImage ( bool  createImage)
inline
Parameters
createImageCreate an image or not

◆ setDatafileSeparator()

template<class Scalar >
void Dumux::GnuplotInterface< Scalar >::setDatafileSeparator ( char  separator)
inline
Parameters
separatorThe separator sign between two data columns

◆ setOpenPlotWindow()

template<class Scalar >
void Dumux::GnuplotInterface< Scalar >::setOpenPlotWindow ( bool  openPlotWindow)
inline
Parameters
openPlotWindowOpen gnuplot or not

◆ setOption()

template<class Scalar >
void Dumux::GnuplotInterface< Scalar >::setOption ( const std::string &  option)
inline
Parameters
optionAdditional line of option in gnuplot language

◆ setOutputDirectory()

template<class Scalar >
void Dumux::GnuplotInterface< Scalar >::setOutputDirectory ( const std::string &  outputDirectory)
inline
Parameters
outputDirectoryThe user-specified terminal

◆ setTerminalType()

template<class Scalar >
void Dumux::GnuplotInterface< Scalar >::setTerminalType ( std::string  terminal)
inline
Parameters
terminalThe user-specified terminal

◆ setXlabel()

template<class Scalar >
void Dumux::GnuplotInterface< Scalar >::setXlabel ( const std::string &  label)
inline
Parameters
labelThe label of the x-axis

◆ setXRange()

template<class Scalar >
void Dumux::GnuplotInterface< Scalar >::setXRange ( Scalar  min,
Scalar  max 
)
inline
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
Parameters
labelThe label of the y-axis

◆ setYRange()

template<class Scalar >
void Dumux::GnuplotInterface< Scalar >::setYRange ( Scalar  min,
Scalar  max 
)
inline
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
Parameters
dashedUse dashed lines

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