Reaktoro
A unified framework for modeling chemically reactive systems
ChemicalPlot Class Reference

A class used to create plots from sequence of chemical states. More...

#include <ChemicalPlot.hpp>

Public Member Functions

 ChemicalPlot ()
 Construct a default ChemicalPlot instance.
 
 ChemicalPlot (const ChemicalSystem &system)
 Construct a ChemicalPlot instance using a ChemicalSystem instance.
 
 ChemicalPlot (const ReactionSystem &reactions)
 Construct a ChemicalPlot instance using a ReactionSystem instance.
 
virtual ~ChemicalPlot ()
 Destroy this ChemicalPlot instance.
 
auto name (std::string name) -> void
 Set the name of the plot and the file names exported.
 
auto x (std::string quantity) -> void
 Set the quantity to be plotted along the x-axis. More...
 
auto y (std::string quantity) -> void
 Add a quantity to be plotted along the y-axis. More...
 
auto y (std::string quantity, std::string label) -> void
 Add a quantity to be plotted along the y-axis with a label. More...
 
auto points (std::string label, std::vector< double > xpoints, std::vector< double > ypoints) -> void
 Add discrete points in the plot. More...
 
auto points (std::string label, std::string xpoints, std::string ypoints) -> void
 Add discrete points in the plot. More...
 
auto legend (std::string) -> void
 Set the legend options. More...
 
auto showlegend (bool active) -> void
 Set true if legend should be displayed in the plot.
 
auto showlegend () const -> bool
 Return true if legend should be displayed in the plot.
 
auto title (std::string title) -> void
 Set the title of the plot.
 
auto xlabel (std::string) -> void
 Set the label of the x-axis. More...
 
auto ylabel (std::string) -> void
 Set the label of the y-axis. More...
 
auto xtics (std::string) -> void
 Set the tics of the x-axis. More...
 
auto ytics (std::string) -> void
 Set the tics of the y-axis. More...
 
auto xformat (std::string) -> void
 Set the numeric display format of the x-axis. More...
 
auto yformat (std::string) -> void
 Set the numeric display format of the y-axis. More...
 
auto xlogscale (int base=10) -> void
 Set the x-axis to log-scale.
 
auto ylogscale (int base=10) -> void
 Set the y-axis to log-scale.
 
auto frequency (unsigned frequency) -> void
 Set the refresh rate of the real-time plot.
 
auto operator<< (std::string command) -> ChemicalPlot &
 Inject a gnuplot command to the script file.
 
auto operator<< (std::stringstream command) -> ChemicalPlot &
 Inject a gnuplot command to the script file.
 
auto open () -> void
 Open the plot.
 
auto update (const ChemicalState &state, double t) -> void
 Update the plot with a new chemical state and a tag.
 
auto operator== (const ChemicalPlot &other) -> bool
 Compare a ChemicalPlot instance for equality.
 

Detailed Description

A class used to create plots from sequence of chemical states.

Member Function Documentation

◆ x()

auto x ( std::string  quantity) -> void

Set the quantity to be plotted along the x-axis.

Usage Example

plot.x("pH");
See also
ChemicalQuantity

◆ y() [1/2]

auto y ( std::string  quantity) -> void

Add a quantity to be plotted along the y-axis.

Usage Example

plot.y("elementAmount(Ca)");
plot.y("speciesMass(Calcite)");
Note
This method can be called multiple times.
Parameters
quantityThe quantity to be plotted.
See also
ChemicalQuantity

◆ y() [2/2]

auto y ( std::string  quantity,
std::string  label 
) -> void

Add a quantity to be plotted along the y-axis with a label.

Usage Example

plot.y("elementAmount(Ca)", "Ca [mol]");
plot.y("speciesMass(Calcite)", "Calcite [kg]");
Note
This method can be called multiple times.
Parameters
quantityThe quantity to be plotted.
labelThe label of the quantity displayed in the legend.
See also
ChemicalQuantity

◆ points() [1/2]

auto points ( std::string  label,
std::vector< double >  xpoints,
std::vector< double >  ypoints 
) -> void

Add discrete points in the plot.

Usage Example

Parameters
labelThe label used in the legend to describe the points.
xpointsThe x-coordinates of the points.
ypointsThe y-coordinates of the points.

◆ points() [2/2]

auto points ( std::string  label,
std::string  xpoints,
std::string  ypoints 
) -> void

Add discrete points in the plot.

Parameters
labelThe label used in the legend to describe the points.
xpointsThe x-coordinates of the points separated by comma or space.
ypointsThe y-coordinates of the points separated by comma or space.

◆ legend()

auto legend ( std::string  options) -> void

Set the legend options.

Usage Example

plot.legend("left top");
plot.legend("right center");
See also
showlegend

◆ xlabel()

auto xlabel ( std::string  str) -> void

Set the label of the x-axis.

See also
ylabel

◆ ylabel()

auto ylabel ( std::string  str) -> void

Set the label of the y-axis.

See also
xlabel

◆ xtics()

auto xtics ( std::string  str) -> void

Set the tics of the x-axis.

See also
ytics

◆ ytics()

auto ytics ( std::string  str) -> void

Set the tics of the y-axis.

See also
xtics

◆ xformat()

auto xformat ( std::string  str) -> void

Set the numeric display format of the x-axis.

Usage Example

plot.xformat("%f"); // sets floating point notation.
plot.xformat("%e"); // sets exponential notation using lower case `e`.
plot.xformat("%E"); // sets exponential notation using upper case `E`.
plot.xformat("%g"); // sets exponential notation like "%e", but shorter.
plot.xformat("%G"); // sets exponential notation like "%E", but shorter.
Note
The full list of supported format specifiers can be found in the user's manual of Gnuplot v5.0, at page 123.
See also
yformat

◆ yformat()

auto yformat ( std::string  str) -> void

Set the numeric display format of the y-axis.

Usage Example

plot.yformat("%f"); // sets floating point notation.
plot.yformat("%e"); // sets exponential notation using lower case `e`.
plot.yformat("%E"); // sets exponential notation using upper case `E`.
plot.yformat("%g"); // sets exponential notation like "%e", but shorter.
plot.yformat("%G"); // sets exponential notation like "%E", but shorter.
Note
The full list of supported format specifiers can be found in the user's manual of Gnuplot v5.0, at page 123.
See also
xformat

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