Signalsmith's Basic C++ Plots  1.1.0
A minimal C++ plotting library
Methods | Attributes
signalsmith::plot::Plot2D Class Reference

Inherits signalsmith::plot::SvgFileDrawable.

Methods

AxisnewX (double lowRatio=0, double highRatio=1)
 Creates an X axis, covering some portion of the left/right side. More...
 
AxisnewY (double lowRatio=0, double highRatio=1)
 Creates a Y axis, covering some portion of the bottom/top side. More...
 
 Plot2D (double width, double height)
 
 Plot2D (Axis ax, Axis ay)
 
void writeData (SvgWriter &svg, const PlotStyle &style) override
 
void writeLabel (SvgWriter &svg, const PlotStyle &style) override
 
void layout (const PlotStyle &style) override
 
Line2Dline (Axis &x, Axis &y, PlotStyle::Counter styleIndex)
 
Line2Dline (Axis &x, Axis &y)
 
Line2Dline (PlotStyle::Counter styleIndex)
 
Line2Dline ()
 
template<class ... Args>
Line2Dfill (Args &&...args)
 Convenience method, returns a line set to only fill. More...
 
Legendlegend (double xRatio, double yRatio)
 Creates a legend at a given position. More...
 
Imageimage (Axis &x, Axis &y, Bounds dataBounds, const std::string &url)
 
Imageimage (Bounds dataBounds, const std::string &url)
 
Imageimage (double left, double right, double top, double bottom, const std::string &url)
 
- Methods inherited from signalsmith::plot::SvgFileDrawable
virtual PlotStyle defaultStyle () const
 
void write (std::ostream &o, const PlotStyle &style)
 
void write (const std::string &svgFile, const PlotStyle &style)
 
void write (std::ostream &o)
 
void write (const std::string &svgFile)
 
ScheduledWrite writeLater (const std::string &svgFile)
 
- Methods inherited from signalsmith::plot::SvgDrawable
 SvgDrawable (const SvgDrawable &other)=delete
 
SvgDrawableoperator= (const SvgDrawable &other)=delete
 
Bounds layoutIfNeeded (const PlotStyle &style)
 
void addChild (SvgDrawable *child, bool front=false)
 Takes ownership of the child. More...
 
virtual void toFrame (double time, bool clear=true)
 Creates a frame from the current stat, and optionally clears the state ready for the next frame. More...
 
virtual void loopFrame (double loopTime)
 Sets loop time (or < 0 to disable) More...
 
virtual void clearFrames ()
 Removes all animation frames. Mostly useful if re-using the diagram for multiple animations. More...
 

Attributes

Axisx
 
Axisy
 
PlotStyle::Counter styleCounter
 Style for the next auto-styled element. More...
 

Additional Inherited Members

- Protected Member Functions inherited from signalsmith::plot::SvgDrawable
void invalidateLayout ()
 
void addLayoutChild (SvgDrawable *child)
 These children are removed when the layout is invalidated. More...
 
- Protected Attributes inherited from signalsmith::plot::SvgDrawable
Bounds bounds
 

Method Details

◆ fill()

template<class ... Args>
Line2D& signalsmith::plot::Plot2D::fill ( Args &&...  args)
inline

Convenience method, returns a line set to only fill.

◆ legend()

Legend& signalsmith::plot::Plot2D::legend ( double  xRatio,
double  yRatio 
)
inline

Creates a legend at a given position.

If xRatio and yRatio are in the range 0-1, the legend will be inside the plot. Otherwise, it will move outside the plot (e.g. -1 will be left/below the axes, including any labels).

◆ newX()

Axis& signalsmith::plot::Plot2D::newX ( double  lowRatio = 0,
double  highRatio = 1 
)
inline

Creates an X axis, covering some portion of the left/right side.

◆ newY()

Axis& signalsmith::plot::Plot2D::newY ( double  lowRatio = 0,
double  highRatio = 1 
)
inline

Creates a Y axis, covering some portion of the bottom/top side.

Member Data Documentation

◆ styleCounter

PlotStyle::Counter signalsmith::plot::Plot2D::styleCounter

Style for the next auto-styled element.