Plot2D.hpp
88 auto drawCurveWithErrorBarsX(const X& x, const Y& y, const XL& xlow, const XH& xhigh) -> DrawSpecs&;
96 auto drawCurveWithErrorBarsY(const X& x, const Y& y, const YL& ylow, const YH& yhigh) -> DrawSpecs&;
100 auto drawCurveWithErrorBarsXY(const X& x, const Y& y, const XD& xdelta, const YD& ydelta) -> DrawSpecs&;
104 auto drawCurveWithErrorBarsXY(const X& x, const Y& y, const XL& xlow, const XH& xhigh, const YL& ylow, const YH& yhigh) -> DrawSpecs&;
136 auto drawBoxesWithErrorBarsY(const X& x, const Y& y, const YL& ylow, const YH& yhigh) -> DrawSpecs&;
160 auto drawErrorBarsXY(const X& x, const Y& y, const XL& xlow, const XH& xhigh, const YL& ylow, const YH& yhigh) -> DrawSpecs&;
203 auto drawWithCols(const std::string& fname, const std::string& with, const std::vector<ColumnIndex>& cols) -> DrawSpecs&;
209 auto drawCurveWithPoints(const std::string& fname, ColumnIndex xcol, ColumnIndex ycol) -> DrawSpecs&;
212 auto drawCurveWithErrorBarsX(const std::string& fname, ColumnIndex xcol, ColumnIndex ycol, ColumnIndex xdeltacol) -> DrawSpecs&;
215 auto drawCurveWithErrorBarsX(const std::string& fname, ColumnIndex xcol, ColumnIndex ycol, ColumnIndex xlowcol, ColumnIndex xhighcol) -> DrawSpecs&;
218 auto drawCurveWithErrorBarsY(const std::string& fname, ColumnIndex xcol, ColumnIndex ycol, ColumnIndex ydeltacol) -> DrawSpecs&;
221 auto drawCurveWithErrorBarsY(const std::string& fname, ColumnIndex xcol, ColumnIndex ycol, ColumnIndex ylowcol, ColumnIndex yhighcol) -> DrawSpecs&;
224 auto drawCurveWithErrorBarsXY(const std::string& fname, ColumnIndex xcol, ColumnIndex ycol, ColumnIndex xdeltacol, ColumnIndex ydeltacol) -> DrawSpecs&;
227 auto drawCurveWithErrorBarsXY(const std::string& fname, ColumnIndex xcol, ColumnIndex ycol, ColumnIndex xlowcol, ColumnIndex xhighcol, ColumnIndex ylowcol, ColumnIndex yhighcol) -> DrawSpecs&;
233 auto drawBoxes(const std::string& fname, ColumnIndex xcol, ColumnIndex ycol, ColumnIndex xwidthcol) -> DrawSpecs&;
236 auto drawBoxesWithErrorBarsY(const std::string& fname, ColumnIndex xcol, ColumnIndex ycol, ColumnIndex ydeltacol) -> DrawSpecs&;
239 auto drawBoxesWithErrorBarsY(const std::string& fname, ColumnIndex xcol, ColumnIndex ycol, ColumnIndex ylowcol, ColumnIndex yhighcol) -> DrawSpecs&;
242 auto drawErrorBarsX(const std::string& fname, ColumnIndex xcol, ColumnIndex ycol, ColumnIndex xdeltacol) -> DrawSpecs&;
245 auto drawErrorBarsX(const std::string& fname, ColumnIndex xcol, ColumnIndex ycol, ColumnIndex xlowcol, ColumnIndex xhighcol) -> DrawSpecs&;
248 auto drawErrorBarsY(const std::string& fname, ColumnIndex xcol, ColumnIndex ycol, ColumnIndex ydeltacol) -> DrawSpecs&;
251 auto drawErrorBarsY(const std::string& fname, ColumnIndex xcol, ColumnIndex ycol, ColumnIndex ylowcol, ColumnIndex yhighcol) -> DrawSpecs&;
254 auto drawErrorBarsXY(const std::string& fname, ColumnIndex xcol, ColumnIndex ycol, ColumnIndex xdeltacol, ColumnIndex ydeltacol) -> DrawSpecs&;
257 auto drawErrorBarsXY(const std::string& fname, ColumnIndex xcol, ColumnIndex ycol, ColumnIndex xlowcol, ColumnIndex xhighcol, ColumnIndex ylowcol, ColumnIndex yhighcol) -> DrawSpecs&;
263 auto drawStepsChangeFirstX(const std::string& fname, ColumnIndex xcol, ColumnIndex ycol) -> DrawSpecs&;
266 auto drawStepsChangeFirstY(const std::string& fname, ColumnIndex xcol, ColumnIndex ycol) -> DrawSpecs&;
269 auto drawStepsHistogram(const std::string& fname, ColumnIndex xcol, ColumnIndex ycol) -> DrawSpecs&;
272 auto drawStepsFilled(const std::string& fname, ColumnIndex xcol, ColumnIndex ycol) -> DrawSpecs&;
304 inline auto Plot2D::drawWithVecs(const std::string& with, const X& x, const Vecs&... vecs) -> DrawSpecs&
320 use += "xtic(1)"; // this terminates the string with 0:2:3:4:xtic(1), and thus column 1 is used for the xtics
326 // Draw the data saved using a data set with index `m_numdatasets`. Increase number of data sets and set the line style specification (desired behavior is 1, 2, 3 (incrementing as new lines are plotted)).
327 return draw("'" + m_datafilename + "' index " + internal::str(m_numdatasets++), use, with).lineStyle(static_cast<int>(m_drawspecs.size()));
331 inline auto Plot2D::drawWithVecsContainingNaN(std::string with, const X& x, const Vecs&... vecs) -> DrawSpecs&
342 use += "xtic(1)"; // this terminates the string with 0:$(2):$(3):$(4):xtic(1), and thus column 1 is used for the xtics
347 // Draw the data saved using a data set with index `m_numdatasets`. Increase number of data sets and set the line style specification (desired behavior is 1, 2, 3 (incrementing as new lines are plotted)).
348 return draw("'" + m_datafilename + "' index " + internal::str(m_numdatasets++), use, with).lineStyle(static_cast<int>(m_drawspecs.size()));
364 inline auto Plot2D::drawCurveWithErrorBarsX(const X& x, const Y& y, const XD& xdelta) -> DrawSpecs&
370 inline auto Plot2D::drawCurveWithErrorBarsX(const X& x, const Y& y, const XL& xlow, const XH& xhigh) -> DrawSpecs&
376 inline auto Plot2D::drawCurveWithErrorBarsY(const X& x, const Y& y, const YD& ydelta) -> DrawSpecs&
382 inline auto Plot2D::drawCurveWithErrorBarsY(const X& x, const Y& y, const YL& ylow, const YH& yhigh) -> DrawSpecs&
388 inline auto Plot2D::drawCurveWithErrorBarsXY(const X& x, const Y& y, const XD& xdelta, const YD& ydelta) -> DrawSpecs&
394 inline auto Plot2D::drawCurveWithErrorBarsXY(const X& x, const Y& y, const XL& xlow, const XH& xhigh, const YL& ylow, const YH& yhigh) -> DrawSpecs&
436 inline auto Plot2D::drawBoxesWithErrorBarsY(const X& x, const Y& y, const Y& ydelta) -> DrawSpecs&
442 inline auto Plot2D::drawBoxesWithErrorBarsY(const X& x, const Y& y, const YL& ylow, const YH& yhigh) -> DrawSpecs&
454 inline auto Plot2D::drawErrorBarsX(const X& x, const Y& y, const XL& xlow, const XH& xhigh) -> DrawSpecs&
466 inline auto Plot2D::drawErrorBarsY(const X& x, const Y& y, const YL& ylow, const YH& yhigh) -> DrawSpecs&
472 inline auto Plot2D::drawErrorBarsXY(const X& x, const Y& y, const XD& xdelta, const YD& ydelta) -> DrawSpecs&
478 inline auto Plot2D::drawErrorBarsXY(const X& x, const Y& y, const XL& xlow, const XH& xhigh, const YL& ylow, const YH& yhigh) -> DrawSpecs&
534 return drawWithVecs("", y); // empty string because we rely on `set style data histograms` since relying `with histograms` is not working very well (e.g., empty key/lenged appearing in columnstacked mode).
541 inline auto Plot2D::drawWithCols(const std::string& fname, const std::string& with, const std::vector<ColumnIndex>& cols) -> DrawSpecs&
545 use += col.value + ":"; // e.g., "1:4:5:7:" (where 1 is x, 4 is y, 5 is ylow and 7 is yhigh for a yerrorlines plot)
548 return draw(what, use, with).lineStyle(static_cast<int>(m_drawspecs.size())); // e.g., draw(what="'myfile.dat'", use="1:2", with="lines");
551 inline auto Plot2D::drawCurve(const std::string& fname, ColumnIndex xcol, ColumnIndex ycol) -> DrawSpecs&
556 inline auto Plot2D::drawCurveWithPoints(const std::string& fname, ColumnIndex xcol, ColumnIndex ycol) -> DrawSpecs&
561 inline auto Plot2D::drawCurveWithErrorBarsX(const std::string& fname, ColumnIndex xcol, ColumnIndex ycol, ColumnIndex xdeltacol) -> DrawSpecs&
566 inline auto Plot2D::drawCurveWithErrorBarsX(const std::string& fname, ColumnIndex xcol, ColumnIndex ycol, ColumnIndex xlowcol, ColumnIndex xhighcol) -> DrawSpecs&
571 inline auto Plot2D::drawCurveWithErrorBarsY(const std::string& fname, ColumnIndex xcol, ColumnIndex ycol, ColumnIndex ydeltacol) -> DrawSpecs&
576 inline auto Plot2D::drawCurveWithErrorBarsY(const std::string& fname, ColumnIndex xcol, ColumnIndex ycol, ColumnIndex ylowcol, ColumnIndex yhighcol) -> DrawSpecs&
581 inline auto Plot2D::drawCurveWithErrorBarsXY(const std::string& fname, ColumnIndex xcol, ColumnIndex ycol, ColumnIndex xdeltacol, ColumnIndex ydeltacol) -> DrawSpecs&
586 inline auto Plot2D::drawCurveWithErrorBarsXY(const std::string& fname, ColumnIndex xcol, ColumnIndex ycol, ColumnIndex xlowcol, ColumnIndex xhighcol, ColumnIndex ylowcol, ColumnIndex yhighcol) -> DrawSpecs&
591 inline auto Plot2D::drawBoxes(const std::string& fname, ColumnIndex xcol, ColumnIndex ycol) -> DrawSpecs&
596 inline auto Plot2D::drawBoxes(const std::string& fname, ColumnIndex xcol, ColumnIndex ycol, ColumnIndex xwidthcol) -> DrawSpecs&
601 inline auto Plot2D::drawBoxesWithErrorBarsY(const std::string& fname, ColumnIndex xcol, ColumnIndex ycol, ColumnIndex ydeltacol) -> DrawSpecs&
606 inline auto Plot2D::drawBoxesWithErrorBarsY(const std::string& fname, ColumnIndex xcol, ColumnIndex ycol, ColumnIndex ylowcol, ColumnIndex yhighcol) -> DrawSpecs&
611 inline auto Plot2D::drawErrorBarsX(const std::string& fname, ColumnIndex xcol, ColumnIndex ycol, ColumnIndex xdeltacol) -> DrawSpecs&
616 inline auto Plot2D::drawErrorBarsX(const std::string& fname, ColumnIndex xcol, ColumnIndex ycol, ColumnIndex xlowcol, ColumnIndex xhighcol) -> DrawSpecs&
621 inline auto Plot2D::drawErrorBarsY(const std::string& fname, ColumnIndex xcol, ColumnIndex ycol, ColumnIndex ydeltacol) -> DrawSpecs&
626 inline auto Plot2D::drawErrorBarsY(const std::string& fname, ColumnIndex xcol, ColumnIndex ycol, ColumnIndex ylowcol, ColumnIndex yhighcol) -> DrawSpecs&
631 inline auto Plot2D::drawErrorBarsXY(const std::string& fname, ColumnIndex xcol, ColumnIndex ycol, ColumnIndex xdeltacol, ColumnIndex ydeltacol) -> DrawSpecs&
636 inline auto Plot2D::drawErrorBarsXY(const std::string& fname, ColumnIndex xcol, ColumnIndex ycol, ColumnIndex xlowcol, ColumnIndex xhighcol, ColumnIndex ylowcol, ColumnIndex yhighcol) -> DrawSpecs&
641 inline auto Plot2D::drawSteps(const std::string& fname, ColumnIndex xcol, ColumnIndex ycol) -> DrawSpecs&
646 inline auto Plot2D::drawStepsChangeFirstX(const std::string& fname, ColumnIndex xcol, ColumnIndex ycol) -> DrawSpecs&
651 inline auto Plot2D::drawStepsChangeFirstY(const std::string& fname, ColumnIndex xcol, ColumnIndex ycol) -> DrawSpecs&
656 inline auto Plot2D::drawStepsHistogram(const std::string& fname, ColumnIndex xcol, ColumnIndex ycol) -> DrawSpecs&
661 inline auto Plot2D::drawStepsFilled(const std::string& fname, ColumnIndex xcol, ColumnIndex ycol) -> DrawSpecs&
666 inline auto Plot2D::drawDots(const std::string& fname, ColumnIndex xcol, ColumnIndex ycol) -> DrawSpecs&
671 inline auto Plot2D::drawPoints(const std::string& fname, ColumnIndex xcol, ColumnIndex ycol) -> DrawSpecs&
676 inline auto Plot2D::drawImpulses(const std::string& fname, ColumnIndex xcol, ColumnIndex ycol) -> DrawSpecs&
694 script << "#==============================================================================" << std::endl;
696 script << "#==============================================================================" << std::endl;
731 script << "#==============================================================================" << std::endl;
733 script << "#==============================================================================" << std::endl;
740 script << "#==============================================================================" << std::endl;
742 script << "#==============================================================================" << std::endl;
748 script << " " << m_drawspecs[i] << (i < n - 1 ? ", \\\n" : ""); // consider indentation with 4 spaces!
auto drawWithVecs(const std::string &with, const X &, const Vecs &... vecs) -> DrawSpecs &
Draw plot object with given style and given vectors (e.g., plot.draw("lines", x, y)).
Definition: Plot2D.hpp:304
TicsSpecsMajor m_ytics_major_left
The specs for the major ytics at the left.
Definition: Plot.hpp:227
auto drawBoxes(const X &x, const Y &y) -> DrawSpecs &
Draw boxes with given x and y vectors.
Definition: Plot2D.hpp:424
auto repr() const -> std::string override
Convert this plot object into a gnuplot formatted string.
Definition: Plot2D.hpp:690
auto drawPoints(const X &x, const Y &y) -> DrawSpecs &
Draw points with given x and y vectors.
Definition: Plot2D.hpp:520
auto drawWithVecsContainingNaN(std::string with, const X &, const Vecs &... vecs) -> DrawSpecs &
Draw plot object with given style and given vectors (e.g., plot.draw("lines", x, y)) that may contain...
Definition: Plot2D.hpp:331
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 drawImpulses(const X &x, const Y &y) -> DrawSpecs &
Draw impulses with given x and y vectors.
Definition: Plot2D.hpp:526
std::string m_samples
The number of sample points for functions.
Definition: Plot.hpp:240
auto drawDots(const X &x, const Y &y) -> DrawSpecs &
Draw dots with given x and y vectors.
Definition: Plot2D.hpp:514
std::string m_palette
The name of the gnuplot palette to be used.
Definition: Plot.hpp:210
auto drawBrokenCurveWithPoints(const X &x, const Y &y) -> DrawSpecs &
Draw a curve with points with given x and y vectors, breaking this curve whenever NaN is found in x o...
Definition: Plot2D.hpp:406
GridSpecs m_grid
The vector of grid specs for the major and minor grid lines in the plot (for xtics,...
Definition: Plot.hpp:218
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
auto drawCurvesFilled(const X &x, const Y1 &y1, const Y2 &y2) -> DrawSpecs &
Draw curves with given x, y1 and y2 vectors with filled areas above / below / between curves.
Definition: Plot2D.hpp:418
auto drawErrorBarsX(const X &x, const Y &y, const XD &xdelta) -> DrawSpecs &
Draw error bars along x with given x, y, and xdelta vectors.
Definition: Plot2D.hpp:448
TicsSpecsMajor m_xtics_major_top
The specs for the major xtics at the top.
Definition: Plot.hpp:224
auto drawStepsFilled(const X &x, const Y &y) -> DrawSpecs &
Draw steps with given x and y vectors with filled area below steps.
Definition: Plot2D.hpp:508
auto drawCurveFilled(const X &x, const Y &y) -> DrawSpecs &
Draw curves with given x and y vectors with filled areas above / below axes.
Definition: Plot2D.hpp:412
auto drawCurveWithPoints(const X &x, const Y &y) -> DrawSpecs &
Draw a curve with points with given x and y vectors.
Definition: Plot2D.hpp:358
auto drawStepsChangeFirstY(const X &x, const Y &y) -> DrawSpecs &
Draw steps with given x and y vectors with steps along y changes first.
Definition: Plot2D.hpp:496
TicsSpecsMajor m_ztics_major
The specs for the major ztics.
Definition: Plot.hpp:231
auto drawErrorBarsY(const X &x, const Y &y, const YD &ydelta) -> DrawSpecs &
Draw error bars along y with given x, y, and ydelta vectors.
Definition: Plot2D.hpp:460
auto drawWithCols(const std::string &fname, const std::string &with, const std::vector< ColumnIndex > &cols) -> DrawSpecs &
Draw plot object with given style and given vectors (e.g., plot.draw("lines", x, y)).
Definition: Plot2D.hpp:541
auto drawCurveWithErrorBarsX(const X &x, const Y &y, const XD &xdelta) -> DrawSpecs &
Draw a curve with error bars along x with given x, y, and xdelta vectors.
Definition: Plot2D.hpp:364
auto drawErrorBarsXY(const X &x, const Y &y, const XD &xdelta, const YD &ydelta) -> DrawSpecs &
Draw error bars along x and y with given x, y, xdelta, and ydelta vectors.
Definition: Plot2D.hpp:472
auto drawBoxesWithErrorBarsY(const X &x, const Y &y, const Y &ydelta) -> DrawSpecs &
Draw boxes with error bars along y with given x, y, ydelta vectors.
Definition: Plot2D.hpp:436
auto drawCurveWithErrorBarsY(const X &x, const Y &y, const YD &ydelta) -> DrawSpecs &
Draw a curve with error bars along y with given x, y, and ydelta vectors.
Definition: Plot2D.hpp:376
std::string m_boxwidth
The default width of boxes in plots containing boxes without given widths.
Definition: Plot.hpp:238
An auxiliary type used to represent a data column index.
Definition: ColumnIndex.hpp:35
auto drawBrokenCurve(const X &x, const Y &y) -> DrawSpecs &
Draw a curve with given x and y vectors, breaking this curve whenever NaN is found in x or y.
Definition: Plot2D.hpp:400
TicsSpecsMinor m_xtics_minor_bottom
The specs for the minor xtics at the bottom.
Definition: Plot.hpp:225
TicsSpecsMinor m_ytics_minor_left
The specs for the minor ytics at the left.
Definition: Plot.hpp:229
TicsSpecsMinor m_xtics_minor_top
The specs for the minor xtics at the top.
Definition: Plot.hpp:226
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 drawCurve(const X &x, const Y &y) -> DrawSpecs &
Draw a curve with given x and y vectors.
Definition: Plot2D.hpp:352
TicsSpecsMajor m_xtics_major_bottom
The specs for the major xtics at the bottom.
Definition: Plot.hpp:223
auto drawStepsHistogram(const X &x, const Y &y) -> DrawSpecs &
Draw steps with given x and y vectors in a histogram style.
Definition: Plot2D.hpp:502
auto drawHistogram(const Y &y) -> DrawSpecs &
Draw a histogram for the given y vector.
Definition: Plot2D.hpp:532
The class used to create a plot containing graphical elements.
Definition: Plot2D.hpp:58
auto drawStepsChangeFirstX(const X &x, const Y &y) -> DrawSpecs &
Draw steps with given x and y vectors with steps along x changes first.
Definition: Plot2D.hpp:490
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
TicsSpecsMinor m_rtics_minor
The specs for the minor rtics.
Definition: Plot.hpp:234
TicsSpecsMajor m_rtics_major
The specs for the major rtics.
Definition: Plot.hpp:233
auto drawSteps(const X &x, const Y &y) -> DrawSpecs &
Draw steps with given x and y vectors. Identical to drawStepsChangeFirstX.
Definition: Plot2D.hpp:484
auto drawCurveWithErrorBarsXY(const X &x, const Y &y, const XD &xdelta, const YD &ydelta) -> DrawSpecs &
Draw a curve with error bars along x and y with given x, y, xdelta, and ydelta vectors.
Definition: Plot2D.hpp:388
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