Signalsmith's Basic C++ Plots  1.1.0
A minimal C++ plotting library
Loading...
Searching...
No Matches
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.
 
AxisnewY (double lowRatio=0, double highRatio=1)
 Creates a Y axis, covering some portion of the bottom/top side.
 
 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.
 
template<class ... Args>
Line2DlineFill (Args &&...args)
 Convenience method, returns a line including fills.
 
Legendlegend (double xRatio, double yRatio)
 Creates a legend at a given position.
 
Imageimage (Axis &x, Axis &y, Bounds dataBounds, const std::string &url)
 Embeds an image using the given data co-ordinates.
 
Imageimage (Bounds dataBounds, const std::string &url)
 
Imageimage (double left, double right, double top, double bottom, const std::string &url)
 
Plot2Dtitle (const std::string &t, double rx=0.5, double ry=2)
 Adds a title to the plot, using the same position rules as .legend()
 
- Methods inherited from signalsmith::plot::SvgFileDrawable
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.
 
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.
 
virtual void loopFrame (double loopTime)
 Sets loop time (or < 0 to disable) for this element and all children.
 
virtual void clearFrames ()
 Removes all animation frames. Mostly useful if re-using the diagram for multiple animations.
 

Attributes

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

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.
 
- 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.

◆ image()

Image & signalsmith::plot::Plot2D::image ( Axis & x,
Axis & y,
Bounds dataBounds,
const std::string & url )
inline

Embeds an image using the given data co-ordinates.

◆ layout()

void signalsmith::plot::Plot2D::layout ( const PlotStyle & style)
inlineoverridevirtual

Reimplemented from signalsmith::plot::SvgDrawable.

◆ 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).

◆ lineFill()

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

Convenience method, returns a line including fills.

◆ 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.

◆ title()

Plot2D & signalsmith::plot::Plot2D::title ( const std::string & t,
double rx = 0.5,
double ry = 2 )
inline

Adds a title to the plot, using the same position rules as .legend()

◆ writeData()

void signalsmith::plot::Plot2D::writeData ( SvgWriter & svg,
const PlotStyle & style )
inlineoverridevirtual

Reimplemented from signalsmith::plot::SvgDrawable.

◆ writeLabel()

void signalsmith::plot::Plot2D::writeLabel ( SvgWriter & svg,
const PlotStyle & style )
inlineoverridevirtual

Reimplemented from signalsmith::plot::SvgDrawable.

Member Data Documentation

◆ styleCounter

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

Style for the next auto-styled element.