Plot.hpp
174 auto draw(const std::string& what, const std::string& use, const std::string& with) -> DrawSpecs&;
250 : m_id(m_counter++), m_datafilename("plot" + internal::str(m_id) + ".dat"), m_xlabel("x"), m_ylabel("y"), m_rlabel("r"), m_xtics_major_bottom("x"), m_xtics_major_top("x2"), m_xtics_minor_bottom("x"), m_xtics_minor_top("x2"), m_ytics_major_left("y"), m_ytics_major_right("y2"), m_ytics_minor_left("y"), m_ytics_minor_right("y2"), m_ztics_major("z"), m_ztics_minor("z"), m_rtics_major("r"), m_rtics_minor("r")
271 // This is needed because of how drawHistogram works. Using `with histograms` don't work as well.
342 inline auto Plot::draw(const std::string& what, const std::string& use, const std::string& with) -> DrawSpecs&
auto yticsMajorLeft() -> TicsSpecsMajor &
Return the specifications of the grid lines along major ytics on the left axis.
Definition: Plot.hpp:136
auto xrange(const StringOrDouble &min, const StringOrDouble &max) -> Plot &
Set the x-range of the plot (also possible with empty values or autoscale options (e....
Definition: Plot.hpp:314
An auxiliary type used to store a string value, while the input can also be a double.
Definition: StringOrDouble.hpp:35
TicsSpecsMajor m_ytics_major_left
The specs for the major ytics at the left.
Definition: Plot.hpp:227
auto autoclean(bool enable=true) -> void
Toggle automatic cleaning of temporary files (enabled by default).
Definition: Plot.hpp:379
auto xtics() -> TicsSpecsMajor &
Return the specifications of the grid lines along major xtics on the bottom axis.
Definition: Plot.hpp:112
auto yticsMinorLeft() -> TicsSpecsMinor &
Return the specifications of the grid lines along minor ytics on the left axis.
Definition: Plot.hpp:142
auto rtics() -> TicsSpecsMajor &
Return the specifications of the grid lines along major rtics.
Definition: Plot.hpp:121
auto boxWidthAbsolute(double val) -> Plot &
Set the default width of boxes in plots containing boxes (in absolute mode).
Definition: Plot.hpp:326
std::string m_xrange
The x-range of the plot as a gnuplot formatted string (e.g., "set xrange [0:1]")
Definition: Plot.hpp:219
auto tics() -> TicsSpecs &
Set the tics of the plot and return a reference to the corresponding specs object.
Definition: Plot.hpp:109
auto yticsMajorRight() -> TicsSpecsMajor &
Return the specifications of the grid lines along major ytics on the right axis.
Definition: Plot.hpp:139
auto styleHistogram() -> HistogramStyleSpecs &
Return an object that permits histogram style to be customized.
Definition: Plot.hpp:167
auto cleanup() const -> void
Delete all files used to store plot data or scripts.
Definition: Plot.hpp:384
The class used to specify options for minor tics of a specific axis.
Definition: TicsSpecsMinor.hpp:41
auto rticsMinor() -> TicsSpecsMinor &
Return the specifications of the grid lines along minor rtics.
Definition: Plot.hpp:157
std::string m_samples
The number of sample points for functions.
Definition: Plot.hpp:240
auto yticsMinorRight() -> TicsSpecsMinor &
Return the specifications of the grid lines along minor ytics on the right axis.
Definition: Plot.hpp:145
std::size_t m_id
The Plot id derived from m_counter upon construction (must be the first member due to constructor ini...
Definition: Plot.hpp:208
auto rticsMajor() -> TicsSpecsMajor &
Return the specifications of the grid lines along minor rtics.
Definition: Plot.hpp:154
std::string m_palette
The name of the gnuplot palette to be used.
Definition: Plot.hpp:210
auto xticsMajorBottom() -> TicsSpecsMajor &
Return the specifications of the grid lines along major xtics on the bottom axis.
Definition: Plot.hpp:124
auto fontSize(std::size_t size) -> Plot &
Set the font size for the plot (e.g., 10, 12, 16).
Definition: Plot.hpp:295
auto gnuplot(const std::string &command) -> void
Use this method to provide gnuplot commands to be executed before the plotting calls.
Definition: Plot.hpp:364
auto draw(const std::string &what, const std::string &use, const std::string &with) -> DrawSpecs &
Draw plot object with given what, using and with expressions (e.g., plot.draw("sin(x)*cos(x)",...
Definition: Plot.hpp:342
auto legend() -> LegendSpecs &
Set the legend of the plot and return a reference to the corresponding specs object.
Definition: Plot.hpp:354
GridSpecs m_grid
The vector of grid specs for the major and minor grid lines in the plot (for xtics,...
Definition: Plot.hpp:218
auto fontSize(std::size_t size) -> DerivedSpecs &
Set the point size of the font (e.g., 10, 12, 16).
Definition: FontSpecsOf.hpp:74
FillStyleSpecs m_style_fill
The specs for the fill style of the plot elements in the plot that can be painted.
Definition: Plot.hpp:239
The specifications for an axis label (e.g., xlabel, ylabel, etc.)
Definition: AxisLabelSpecs.hpp:37
TicsSpecsMajor m_xtics_major_top
The specs for the major xtics at the top.
Definition: Plot.hpp:224
auto samples(std::size_t value) -> void
Set the number of sample points for analytical plots.
Definition: Plot.hpp:359
The class used to specify options for major tics of a specific axis.
Definition: TicsSpecsMajor.hpp:40
virtual auto repr() const -> std::string=0
Convert this plot object into a gnuplot formatted string.
auto palette(const std::string &name) -> Plot &
Set the palette of colors for the plot.
Definition: Plot.hpp:275
TicsSpecsMajor m_ztics_major
The specs for the major ztics.
Definition: Plot.hpp:231
auto boxWidthRelative(double val) -> Plot &
Set the default width of boxes in plots containing boxes (in relative mode).
Definition: Plot.hpp:332
std::size_t m_numdatasets
The current number of data sets in the data file.
Definition: Plot.hpp:215
auto xlabel(const std::string &label) -> AxisLabelSpecs &
Set the label of the x-axis and return a reference to the corresponding specs object.
Definition: Plot.hpp:302
static std::size_t m_counter
Counter of how many plot / singleplot objects have been instanciated in the application.
Definition: Plot.hpp:207
auto zticsMinor() -> TicsSpecsMinor &
Return the specifications of the grid lines along minor ztics.
Definition: Plot.hpp:151
The class used to attach color or pattern fill options to a type.
Definition: FillStyleSpecs.hpp:38
auto xticsMinorBottom() -> TicsSpecsMinor &
Return the specifications of the grid lines along minor xtics on the bottom axis.
Definition: Plot.hpp:130
std::string m_boxwidth
The default width of boxes in plots containing boxes without given widths.
Definition: Plot.hpp:238
The class used to specify histogram style options.
Definition: HistogramStyleSpecs.hpp:36
auto text(std::string text) -> AxisLabelSpecs &
Set the text of the axis label.
Definition: AxisLabelSpecs.hpp:73
auto zticsMajor() -> TicsSpecsMajor &
Return the specifications of the grid lines along major ztics.
Definition: Plot.hpp:148
TicsSpecsMinor m_xtics_minor_bottom
The specs for the minor xtics at the bottom.
Definition: Plot.hpp:225
auto clear() -> void
Clear all draw and gnuplot commands.
Definition: Plot.hpp:389
auto xticsMinorTop() -> TicsSpecsMinor &
Return the specifications of the grid lines along minor xtics on the top axis.
Definition: Plot.hpp:133
TicsSpecsMinor m_ytics_minor_left
The specs for the minor ytics at the left.
Definition: Plot.hpp:229
auto xticsMajorTop() -> TicsSpecsMajor &
Return the specifications of the grid lines along major xtics on the top axis.
Definition: Plot.hpp:127
auto grid() -> GridSpecs &
Set the grid of the plot and return a reference to the corresponding specs object.
Definition: Plot.hpp:82
TicsSpecsMinor m_xtics_minor_top
The specs for the minor xtics at the top.
Definition: Plot.hpp:226
auto fontName(std::string name) -> DerivedSpecs &
Set the name of the font (e.g., Helvetica, Georgia, Times).
Definition: FontSpecsOf.hpp:67
TicsSpecsMinor m_ztics_minor
The specs for the minor ztics.
Definition: Plot.hpp:232
TicsSpecsMajor m_ytics_major_right
The specs for the major ytics at the right.
Definition: Plot.hpp:228
auto ztics() -> TicsSpecsMajor &
Return the specifications of the grid lines along major ztics.
Definition: Plot.hpp:118
bool m_autoclean
Toggle automatic cleaning of temporary files (enabled by default)
Definition: Plot.hpp:209
std::string m_datafilename
The multi data set file where data given to plot (e.g., vectors) are saved.
Definition: Plot.hpp:213
TicsSpecsMajor m_xtics_major_bottom
The specs for the major xtics at the bottom.
Definition: Plot.hpp:223
The class used to specify options for plot border.
Definition: BorderSpecs.hpp:41
auto fontName(const std::string &name) -> Plot &
Set the font name for the plot (e.g., Helvetica, Georgia, Times).
Definition: Plot.hpp:288
std::string m_yrange
The y-range of the plot as a gnuplot formatted string (e.g., "set yrange [0:1]")
Definition: Plot.hpp:220
HistogramStyleSpecs m_style_histogram
The specs for the histogram style of the plot.
Definition: Plot.hpp:221
std::vector< std::string > m_customcmds
The strings containing gnuplot custom commands.
Definition: Plot.hpp:243
The class where options for the plotted element can be specified.
Definition: DrawSpecs.hpp:41
auto border() -> BorderSpecs &
Set the border of the plot and return a reference to the corresponding specs object.
Definition: Plot.hpp:79
TicsSpecsMinor m_rtics_minor
The specs for the minor rtics.
Definition: Plot.hpp:234
auto yrange(const StringOrDouble &min, const StringOrDouble &max) -> Plot &
Set the y-range of the plot (also possible with empty values or autoscale options (e....
Definition: Plot.hpp:320
auto ylabel(const std::string &label) -> AxisLabelSpecs &
Set the label of the y-axis and return a reference to the corresponding specs object.
Definition: Plot.hpp:308
TicsSpecsMajor m_rtics_major
The specs for the major rtics.
Definition: Plot.hpp:233
auto size(std::size_t width, std::size_t height) -> Plot &
Set the size of the plot (in unit of points, with 1 inch = 72 points).
Definition: Plot.hpp:281
auto savePlotData() const -> void
Write the current plot data to the data file.
Definition: Plot.hpp:369
auto ytics() -> TicsSpecsMajor &
Return the specifications of the grid lines along major ytics on the left axis.
Definition: Plot.hpp:115
std::vector< DrawSpecs > m_drawspecs
The plot specs for each call to gnuplot plot function.
Definition: Plot.hpp:242
TicsSpecsMinor m_ytics_minor_right
The specs for the minor ytics at the right.
Definition: Plot.hpp:230
auto styleFill() -> FillStyleSpecs &
Return an object that permits fill style to be customized.
Definition: Plot.hpp:164