Allows to setup and plot user-specified plot windows for algorithmic outputs. More...
#include <plot_window.hpp>
Public Member Functions | |
virtual returnValue | addData (uint idx, const VariablesGrid &_newData) |
virtual returnValue | addLine (uint idx, double _lineValue) |
returnValue | addSubplot (PlotWindowSubplot &_subplot) |
returnValue | addSubplot (const Expression &_expression, const char *const _title="", const char *const _xLabel="", const char *const _yLabel="", PlotMode _plotMode=PM_UNKNOWN, double _xRangeLowerLimit=INFTY, double _xRangeUpperLimit=INFTY, double _yRangeLowerLimit=INFTY, double _yRangeUpperLimit=INFTY) |
returnValue | addSubplot (const Expression &_expressionX, const Expression &_expressionY, const char *const _title="", const char *const _xLabel="", const char *const _yLabel="", PlotMode _plotMode=PM_UNKNOWN, double _xRangeLowerLimit=INFTY, double _xRangeUpperLimit=INFTY, double _yRangeLowerLimit=INFTY, double _yRangeUpperLimit=INFTY) |
returnValue | addSubplot (PlotName _name, const char *const _title="", const char *const _xLabel="", const char *const _yLabel="", PlotMode _plotMode=PM_UNKNOWN, double _xRangeLowerLimit=INFTY, double _xRangeUpperLimit=INFTY, double _yRangeLowerLimit=INFTY, double _yRangeUpperLimit=INFTY) |
returnValue | addSubplot (const VariablesGrid &_variable, const char *const _title="", const char *const _xLabel="", const char *const _yLabel="", PlotMode _plotMode=PM_UNKNOWN, double _xRangeLowerLimit=INFTY, double _xRangeUpperLimit=INFTY, double _yRangeLowerLimit=INFTY, double _yRangeUpperLimit=INFTY) |
returnValue | addSubplot (const Curve &_curve, double _xRangeLowerLimit=0.0, double _xRangeUpperLimit=1.0, const char *const _title="", const char *const _xLabel="", const char *const _yLabel="", PlotMode _plotMode=PM_UNKNOWN, double _yRangeLowerLimit=INFTY, double _yRangeUpperLimit=INFTY) |
returnValue | addSubplot3D (const VariablesGrid &_variable, const char *const _title="", const char *const _xLabel="", const char *const _yLabel="", PlotMode _plotMode=PM_UNKNOWN, double _xRangeLowerLimit=INFTY, double _xRangeUpperLimit=INFTY, double _yRangeLowerLimit=INFTY, double _yRangeUpperLimit=INFTY) |
returnValue | clearAllSubplots () |
virtual PlotWindow * | clone () const |
int | getAliasIdx () const |
uint | getNumSubplots () const |
returnValue | getPlotDataRecord (LogRecord &_record) const |
PlotFrequency | getPlotFrequency () const |
virtual returnValue | init () |
BooleanType | isAlias () const |
BooleanType | isEmpty () const |
PlotWindowSubplot & | operator() (uint idx) |
PlotWindowSubplot | operator() (uint idx) const |
returnValue | operator<< (PlotWindowSubplot &_subplot) |
returnValue | operator<< (PlotName _name) |
returnValue | operator<< (const Expression &_name) |
PlotWindow & | operator= (const PlotWindow &rhs) |
virtual returnValue | plot (PlotFrequency _frequency=PLOT_IN_ANY_CASE) |
PlotWindow () | |
PlotWindow (PlotFrequency _frequency) | |
PlotWindow (const PlotWindow &rhs) | |
virtual returnValue | replot (PlotFrequency _frequency=PLOT_IN_ANY_CASE) |
virtual returnValue | setLabelX (uint idx, const char *const xLabel_) |
virtual returnValue | setLabelY (uint idx, const char *const yLabel_) |
returnValue | setPlotData (const Expression &_name, VariablesGrid &value) |
returnValue | setPlotData (LogName _name, VariablesGrid &value) |
returnValue | setPlotDataRecord (LogRecord &_record) |
virtual returnValue | setPlotMode (uint idx, PlotMode plotMode) |
virtual returnValue | setRanges (uint idx, double xRange1, double xRange2, double yRange1, double yRange2) |
virtual returnValue | setTitle (uint idx, const char *const title_) |
virtual | ~PlotWindow () |
Friends | |
class | PlotCollection |
class | Plotting |
Allows to setup and plot user-specified plot windows for algorithmic outputs.
The class PlotWindow allows to setup and plot user-specified plot windows for algorithmic outputs to be plotted during runtime.
A plot windows comprises arbitrarily many PlotWindowSubplots stored in a simple singly-linked list. These subplots store the information which algorithmic output is to be plotted as well as settings defining the style of the subplot. Note, however, that the actual data to be plotted is stored centrally for all subplots within the PlotWindow class for memory reasons. The data required for plotting is stored within a LogRecord.
Additionally, a plot window stores the PlotFrequency defining whether the window is to be plotted at each iteration or only at the start or end, respectively.
Finally, it is interesting to know that PlotWindows can be setup by the user and flushed to UserInterface classes. Internally, PlotWindows are stored as basic singly-linked within a PlotCollection.
Definition at line 76 of file plot_window.hpp.
BEGIN_NAMESPACE_ACADO PlotWindow::PlotWindow | ( | ) |
Default constructor.
Definition at line 47 of file plot_window.cpp.
PlotWindow::PlotWindow | ( | PlotFrequency | _frequency | ) |
Constructor which takes the plot frequency.
@param[in] _frequency Frequency determining at which time instants the window is to be plotted.
Definition at line 66 of file plot_window.cpp.
PlotWindow::PlotWindow | ( | const PlotWindow & | rhs | ) |
Copy constructor (deep copy).
@param[in] rhs Right-hand side object.
Definition at line 86 of file plot_window.cpp.
|
virtual |
Destructor.
Definition at line 116 of file plot_window.cpp.
|
virtual |
Adds an additional discrete data points to be plotted within the subplot with given index.
@param[in] idx Index of subplot. @param[in] _newData Additional discrete data points.
Definition at line 243 of file plot_window.cpp.
|
virtual |
Adds an additional horizontal lines to be plotted within the subplot with given index.
@param[in] idx Index of subplot. @param[in] _lineValue Y-value of the additional horizontal line.
Definition at line 232 of file plot_window.cpp.
|
protected |
Adds all log record items to internal plotDataRecord that that are required to plot variables of given type.
[in] | _type | Type of variable to be plotted. |
Definition at line 614 of file plot_window.cpp.
|
protected |
Adds all log record items to internal plotDataRecord that that are required to plot given expression.
[in] | _expression | Expression to be plotted. |
Definition at line 588 of file plot_window.cpp.
|
protected |
Adds all log record items to internal plotDataRecord that that are required to plot given pre-defined information.
[in] | _name | Pre-defined information to be plotted. |
Definition at line 663 of file plot_window.cpp.
returnValue PlotWindow::addSubplot | ( | PlotWindowSubplot & | _subplot | ) |
Adds a subplot to the singly-linked list.
@param[in] _subplot Subplot to be added.
Definition at line 276 of file plot_window.cpp.
returnValue PlotWindow::addSubplot | ( | const Expression & | _expression, |
const char *const | _title = "" , |
||
const char *const | _xLabel = "" , |
||
const char *const | _yLabel = "" , |
||
PlotMode | _plotMode = PM_UNKNOWN , |
||
double | _xRangeLowerLimit = INFTY , |
||
double | _xRangeUpperLimit = INFTY , |
||
double | _yRangeLowerLimit = INFTY , |
||
double | _yRangeUpperLimit = INFTY |
||
) |
Adds a subplot plotting the given symbolic expression to the singly-linked list. In addition, title and other properties of the subplot can be specified.
[in] | _expression | Symbolic expression to be plotted on the y-axis. |
[in] | _title | Title of the subplot. |
[in] | _xLabel | Label of x-axis of the subplot. |
[in] | _yLabel | Label of y-axis of the subplot. |
[in] | _plotMode | Plot mode, see the PlotMode documentation for details. |
[in] | _xRangeLowerLimit | Lower limit of the x-axis. |
[in] | _xRangeUpperLimit | Upper limit of the x-axis. |
[in] | _yRangeLowerLimit | Lower limit of the y-axis. |
[in] | _yRangeUpperLimit | Upper limit of the y-axis. |
Definition at line 316 of file plot_window.cpp.
returnValue PlotWindow::addSubplot | ( | const Expression & | _expressionX, |
const Expression & | _expressionY, | ||
const char *const | _title = "" , |
||
const char *const | _xLabel = "" , |
||
const char *const | _yLabel = "" , |
||
PlotMode | _plotMode = PM_UNKNOWN , |
||
double | _xRangeLowerLimit = INFTY , |
||
double | _xRangeUpperLimit = INFTY , |
||
double | _yRangeLowerLimit = INFTY , |
||
double | _yRangeUpperLimit = INFTY |
||
) |
Adds a subplot plotting the given symbolic expressions to the singly-linked list. In addition, title and other properties of the subplot can be specified.
[in] | _expressionX | Symbolic expression to be plotted on the x-axis. |
[in] | _expressionY | Symbolic expression to be plotted on the y-axis. |
[in] | _title | Title of the subplot. |
[in] | _xLabel | Label of x-axis of the subplot. |
[in] | _yLabel | Label of y-axis of the subplot. |
[in] | _plotMode | Plot mode, see the PlotMode documentation for details. |
[in] | _xRangeLowerLimit | Lower limit of the x-axis. |
[in] | _xRangeUpperLimit | Upper limit of the x-axis. |
[in] | _yRangeLowerLimit | Lower limit of the y-axis. |
[in] | _yRangeUpperLimit | Upper limit of the y-axis. |
Definition at line 360 of file plot_window.cpp.
returnValue PlotWindow::addSubplot | ( | PlotName | _name, |
const char *const | _title = "" , |
||
const char *const | _xLabel = "" , |
||
const char *const | _yLabel = "" , |
||
PlotMode | _plotMode = PM_UNKNOWN , |
||
double | _xRangeLowerLimit = INFTY , |
||
double | _xRangeUpperLimit = INFTY , |
||
double | _yRangeLowerLimit = INFTY , |
||
double | _yRangeUpperLimit = INFTY |
||
) |
Adds a subplot plotting the given pre-defined information to the singly-linked list. In addition, title and other properties of the subplot can be specified.
[in] | _name | Internal name of pre-defined information to be plotted. |
[in] | _title | Title of the subplot. |
[in] | _xLabel | Label of x-axis of the subplot. |
[in] | _yLabel | Label of y-axis of the subplot. |
[in] | _plotMode | Plot mode, see the PlotMode documentation for details. |
[in] | _xRangeLowerLimit | Lower limit of the x-axis. |
[in] | _xRangeUpperLimit | Upper limit of the x-axis. |
[in] | _yRangeLowerLimit | Lower limit of the y-axis. |
[in] | _yRangeUpperLimit | Upper limit of the y-axis. |
Definition at line 414 of file plot_window.cpp.
returnValue PlotWindow::addSubplot | ( | const VariablesGrid & | _variable, |
const char *const | _title = "" , |
||
const char *const | _xLabel = "" , |
||
const char *const | _yLabel = "" , |
||
PlotMode | _plotMode = PM_UNKNOWN , |
||
double | _xRangeLowerLimit = INFTY , |
||
double | _xRangeUpperLimit = INFTY , |
||
double | _yRangeLowerLimit = INFTY , |
||
double | _yRangeUpperLimit = INFTY |
||
) |
Adds a subplot plotting the given discrete data to the singly-linked list. In addition, title and other properties of the subplot can be specified.
[in] | _variable | Discrete data to be plotted on the y-axis. |
[in] | _title | Title of the subplot. |
[in] | _xLabel | Label of x-axis of the subplot. |
[in] | _yLabel | Label of y-axis of the subplot. |
[in] | _plotMode | Plot mode, see the PlotMode documentation for details. |
[in] | _xRangeLowerLimit | Lower limit of the x-axis. |
[in] | _xRangeUpperLimit | Upper limit of the x-axis. |
[in] | _yRangeLowerLimit | Lower limit of the y-axis. |
[in] | _yRangeUpperLimit | Upper limit of the y-axis. |
Definition at line 456 of file plot_window.cpp.
returnValue PlotWindow::addSubplot | ( | const Curve & | _curve, |
double | _xRangeLowerLimit = 0.0 , |
||
double | _xRangeUpperLimit = 1.0 , |
||
const char *const | _title = "" , |
||
const char *const | _xLabel = "" , |
||
const char *const | _yLabel = "" , |
||
PlotMode | _plotMode = PM_UNKNOWN , |
||
double | _yRangeLowerLimit = INFTY , |
||
double | _yRangeUpperLimit = INFTY |
||
) |
Adds a subplot plotting the given curve to the singly-linked list. In addition, title and other properties of the subplot can be specified.
[in] | _curve | Curve to be plotted on the y-axis. |
[in] | _xRangeLowerLimit | Lower limit of the x-axis. |
[in] | _xRangeUpperLimit | Upper limit of the x-axis. |
[in] | _title | Title of the subplot. |
[in] | _xLabel | Label of x-axis of the subplot. |
[in] | _yLabel | Label of y-axis of the subplot. |
[in] | _plotMode | Plot mode, see the PlotMode documentation for details. |
[in] | _yRangeLowerLimit | Lower limit of the y-axis. |
[in] | _yRangeUpperLimit | Upper limit of the y-axis. |
Definition at line 526 of file plot_window.cpp.
returnValue PlotWindow::addSubplot3D | ( | const VariablesGrid & | _variable, |
const char *const | _title = "" , |
||
const char *const | _xLabel = "" , |
||
const char *const | _yLabel = "" , |
||
PlotMode | _plotMode = PM_UNKNOWN , |
||
double | _xRangeLowerLimit = INFTY , |
||
double | _xRangeUpperLimit = INFTY , |
||
double | _yRangeLowerLimit = INFTY , |
||
double | _yRangeUpperLimit = INFTY |
||
) |
Adds a 3D subplot plotting the given discrete data to the singly-linked list. In addition, title and other properties of the subplot can be specified.
[in] | _variable | Discrete data to be plotted on the y-axis. |
[in] | _title | Title of the subplot. |
[in] | _xLabel | Label of x-axis of the subplot. |
[in] | _yLabel | Label of y-axis of the subplot. |
[in] | _plotMode | Plot mode, see the PlotMode documentation for details. |
[in] | _xRangeLowerLimit | Lower limit of the x-axis. |
[in] | _xRangeUpperLimit | Upper limit of the x-axis. |
[in] | _yRangeLowerLimit | Lower limit of the y-axis. |
[in] | _yRangeUpperLimit | Upper limit of the y-axis. |
Definition at line 491 of file plot_window.cpp.
returnValue PlotWindow::clearAllSubplots | ( | ) |
Clears all subplots from the singly-linked list.
Definition at line 560 of file plot_window.cpp.
|
virtual |
Clone operator returning a base class pointer to a deep copy of the respective class instance.
Reimplemented in GnuplotWindow.
Definition at line 154 of file plot_window.cpp.
Returns internal name of pre-defined plotting information that corresponds to given pre-defined logging information.
[in] | _name | Name of pre-defined logging information. |
Definition at line 705 of file plot_window.cpp.
Returns internal name of pre-defined logging information that corresponds to given pre-defined plotting information.
[in] | _name | Pre-defined information to be plotted. |
Definition at line 678 of file plot_window.cpp.
|
inlineprotected |
|
inlineprotected |
|
inlineprotected |
|
inlineprotected |
|
inlineprotected |
|
inlineprotected |
|
inline |
Returns alias index of window.
|
protected |
Determines suitable range of the y-axis for plotting a given discrete data grid in an automated way.
[in] | dataGridY | Discrete data grid to be plotted. |
[in] | plotFormat | Plot format of data grid to be plotted. |
[out] | lowerLimit | Suggested lower limit of the y-axis. |
[out] | upperLimit | Suggested upper limit of the y-axis. |
Definition at line 936 of file plot_window.cpp.
|
protected |
Determines type and discrete plot data grid for a given data grid to be plotted.
[in] | variable | Variable to be plotted. |
[out] | _type | Type of variable to be plotted. |
[out] | _dataGrid | Discrete plot data grid of variable to be plotted. |
[out] | _discretizationGrid | Higher-level discretization grid of variable to be plotted. |
Definition at line 891 of file plot_window.cpp.
|
protected |
Determines type, discrete plot data grid and the higher-level discretization grid for a given expression to be plotted. The last two arguments are obtained from the internal plotDataRecord.
[in] | expression | Expression to be plotted. |
[out] | _type | Type of variable to be plotted. |
[out] | _dataGrid | Discrete plot data grid of variable to be plotted. |
[out] | _discretizationGrid | Higher-level discretization grid of variable to be plotted. |
Definition at line 851 of file plot_window.cpp.
|
inlineprotected |
Returns pointer to next PlotWindow within a PlotCollection.
|
inline |
Returns number of subplots contained in the window.
|
inline |
Returns deep-copy of internal plotDataRecord.
@param[out] _record Internal plotDataRecord.
|
inline |
Returns current plot frequency determining at which time instants the window is to be plotted
|
protected |
Determines type, discrete plot data grid and the higher-level discretization grid for a given variable to be plotted. The last two arguments are obtained from the internal plotDataRecord.
[in] | variable | Variable to be plotted. |
[out] | _type | Type of variable to be plotted. |
[out] | _dataGrid | Discrete plot data grid of variable to be plotted. |
[out] | _discretizationGrid | Higher-level discretization grid of variable to be plotted. |
Definition at line 757 of file plot_window.cpp.
|
virtual |
Initialized the plot window.
\return SUCCESSFUL_RETURN
Reimplemented in GnuplotWindow.
Definition at line 160 of file plot_window.cpp.
|
inline |
Returns whether window is an alias of another one.
|
inline |
Returns whether the window is empty (i.e. contains no subplots) or not.
|
inline |
Returns a subplot of the singly-linked list with given index.
@param[in] idx Index of desired subplot.
|
inline |
Returns a subplot of the singly-linked list with given index (const version).
@param[in] idx Index of desired subplot.
returnValue PlotWindow::operator<< | ( | PlotWindowSubplot & | _subplot | ) |
Adds a subplot to the singly-linked list.
@param[in] _subplot Subplot to be added. \note This function is doing the same as the corresponding addSubplot member function and is introduced for syntax reasons only.
Definition at line 255 of file plot_window.cpp.
returnValue PlotWindow::operator<< | ( | PlotName | _name | ) |
Adds an subplot of given internal name to the singly-linked list.
@param[in] _name Internal name of subplot to be added. \note This function is doing the same as the corresponding addSubplot member function and is introduced for syntax reasons only.
Definition at line 262 of file plot_window.cpp.
returnValue PlotWindow::operator<< | ( | const Expression & | _name | ) |
Adds an subplot of given internal name to the singly-linked list.
@param[in] _name Internal name of subplot to be added. \note This function is doing the same as the corresponding addSubplot member function and is introduced for syntax reasons only.
Definition at line 269 of file plot_window.cpp.
PlotWindow & PlotWindow::operator= | ( | const PlotWindow & | rhs | ) |
Assignment operator (deep copy).
@param[in] rhs Right-hand side object.
Definition at line 122 of file plot_window.cpp.
|
virtual |
Plots window into a new figure.
@param[in] _frequency Frequency determining at which time instants the window is to be plotted. \return SUCCESSFUL_RETURN
Definition at line 166 of file plot_window.cpp.
|
virtual |
Plots window into existing figure, if possible.
@param[in] _frequency Frequency determining at which time instants the window is to be plotted. \return SUCCESSFUL_RETURN
Reimplemented in GnuplotWindow.
Definition at line 175 of file plot_window.cpp.
|
inlineprotected |
Assigns alias index of window.
@param[in] _aliasIdx New alias index (-1 = no alias window)
|
virtual |
Sets label of x-axis of the subplot with given index.
@param[in] idx Index of subplot. @param[in] xLabel_ New label of x-axis.
Definition at line 190 of file plot_window.cpp.
|
virtual |
Sets label of y-axis of the subplot with given index.
@param[in] idx Index of subplot. @param[in] yLabel_ New label of y-axis.
Definition at line 199 of file plot_window.cpp.
|
inlineprotected |
Assigns pointer to next PlotWindow within a PlotCollection.
@param[in] _next New pointer to next window.
|
inline |
Assigns numerical values of given expression/variable to internal plotDataRecord.
[in] | _name | Name of expression/variable to be plotted. |
[in] | value | New numerical values in form of a discrete data grid. |
|
inline |
Assigns numerical values of given pre-defined plotting information to internal plotDataRecord.
[in] | _name | Name of pre-defined information to be plotted. |
[in] | value | New numerical values in form of a discrete data grid. |
|
inline |
Assigns new internal plotDataRecord.
@param[in] _record New internal plotDataRecord.
|
virtual |
Sets plot mode of the subplot with given index, defining how the data points are to be plotted.
@param[in] idx Index of subplot. @param[in] plotMode New plot mode, see the PlotMode documentation for details.
Definition at line 208 of file plot_window.cpp.
|
virtual |
Sets ranges of the axes of the subplot with given index.
@param[in] idx Index of subplot. @param[in] xRange1 Lower limit of the x-axis. @param[in] xRange2 Upper limit of the x-axis. @param[in] yRange1 Lower limit of the y-axis. @param[in] yRange2 Upper limit of the y-axis.
Definition at line 217 of file plot_window.cpp.
|
virtual |
Sets title of the subplot with given index.
@param[in] idx Index of subplot. @param[in] title_ New title.
Definition at line 182 of file plot_window.cpp.
|
protected |
Sets-up log frequency that corresponds to given plot frequency determining at which time instants the window is to be plotted.
[in] | _frequency | Plot frequency. |
Definition at line 733 of file plot_window.cpp.
|
friend |
Definition at line 78 of file plot_window.hpp.
|
friend |
Definition at line 79 of file plot_window.hpp.
|
protected |
Alias index of window (-1 = no alias window).
Definition at line 755 of file plot_window.hpp.
|
protected |
Pointer to first subplot of the singly-linked list.
Definition at line 759 of file plot_window.hpp.
|
protected |
Frequency determining at which time instants the window is to be plotted.
Definition at line 757 of file plot_window.hpp.
|
protected |
Pointer to last subplot of the singly-linked list.
Definition at line 760 of file plot_window.hpp.
|
protected |
Pointer to next windows within a PlotCollection.
Definition at line 754 of file plot_window.hpp.
|
protected |
Total number of subplots within the singly-linked list of the window.
Definition at line 762 of file plot_window.hpp.
|
protected |
LogRecord to store all data necessary for plotting the window.
Definition at line 764 of file plot_window.hpp.
|
protected |
Definition at line 766 of file plot_window.hpp.
|
protected |
Definition at line 768 of file plot_window.hpp.
|
protected |
Definition at line 767 of file plot_window.hpp.