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

#include <plot.h>

Detailed Description

A map from values to screen-space.

Individual grid/ticks can be added with .major()/.minor()/.tick().

axis.major(4); // default label
axis.major(5, "five"); // explicit label

Multiple grids/ticks can be added using .majors()/.minors()/.ticks(), which accept a variable number of values:

axis.majors(0, 10).minors(2, 4, 6, 8);

Methods

double drawMin () const
 
double drawMax () const
 
double drawSize () const
 
 Axis (double drawLow, double drawHigh)
 
 Axis (const Axis &other)=default
 
void autoValue (double v)
 Register a value for the auto-scale. More...
 
void autoSetup ()
 
Axisblank (bool includeLinked=false)
 Prevent auto-labelling. More...
 
AxisblankLabels (bool includeLinked=false)
 Clear the names from any existing labels. More...
 
AxiscopyFrom (Axis &other, bool clearLabels=false)
 Copy ticks/label from another axis, optionally removing their text. More...
 
AxislinkFrom (Axis &other)
 Link this axis to another, copying any ticks/labels set later as well. More...
 
Axisflip (bool flip=true)
 
Axislabel (std::string l, PlotStyle::Counter index=-1)
 Sets the label, and optionally style to match a particular line. More...
 
const std::string & label () const
 
Axisrange (std::function< double(double)> valueToUnit)
 
Axisrange (double map(double))
 
Axisrange (std::function< double(double)> map, double lowValue, double highValue)
 
Axisrange (double map(double), double lowValue, double highValue)
 
Axislinear (double low, double high)
 
double map (double v)
 
template<class ... Args>
Axismajor (Args &&...args)
 
template<class ... Args>
Axisminor (Args &&...args)
 
template<class ... Args>
Axistick (Args &&...args)
 
Axismajors ()
 
template<class ... Args>
Axismajors (Tick tick, Args ...args)
 
Axisminors ()
 
template<class ... Args>
Axisminors (Tick tick, Args ...args)
 
Axisticks ()
 
template<class ... Args>
Axisticks (Tick t, Args ...args)
 

Attributes

double drawLow
 
double drawHigh
 
PlotStyle::Counter styleIndex = -1
 Not associated with a particular line by default, but can be. More...
 
bool flipped = false
 Whether the axis should draw on the non-default side (e.g. right/top) More...
 
std::vector< TicktickList
 

Method Details

◆ autoValue()

void signalsmith::plot::Axis::autoValue ( double  v)
inline

Register a value for the auto-scale.

◆ blank()

Axis& signalsmith::plot::Axis::blank ( bool  includeLinked = false)
inline

Prevent auto-labelling.

◆ blankLabels()

Axis& signalsmith::plot::Axis::blankLabels ( bool  includeLinked = false)
inline

Clear the names from any existing labels.

◆ copyFrom()

Axis& signalsmith::plot::Axis::copyFrom ( Axis other,
bool  clearLabels = false 
)
inline

Copy ticks/label from another axis, optionally removing their text.

◆ label()

Axis& signalsmith::plot::Axis::label ( std::string  l,
PlotStyle::Counter  index = -1 
)
inline

Sets the label, and optionally style to match a particular line.

◆ linkFrom()

Axis& signalsmith::plot::Axis::linkFrom ( Axis other)
inline

Link this axis to another, copying any ticks/labels set later as well.

Member Data Documentation

◆ flipped

bool signalsmith::plot::Axis::flipped = false

Whether the axis should draw on the non-default side (e.g. right/top)

◆ styleIndex

PlotStyle::Counter signalsmith::plot::Axis::styleIndex = -1

Not associated with a particular line by default, but can be.