plot::scale
Axis scales: the map from data values to a linear screen coordinate.
Enums
ScaleSource
pub enum ScaleHow an axis maps values to positions.
nabi
use plot::Scale;
assert(Scale::Log(10.0).forward(1000.0) == 3.0);
assert(Scale::Symlog { base: 10.0, linthresh: 1.0 }.forward(-10.0) == -2.0);
Evenly spaced values.
Logarithmic in this base; values must be positive.
Linear within
[-linthresh, linthresh], logarithmic outside, so zero and both signs fit (matplotlib'ssymlog).Linear in seconds since 1970-01-01 UTC, with calendar ticks.
The screen-linear coordinate of
v.nabiassert(plot::Scale::Log(2.0).forward(8.0) == 3.0);The value at screen-linear coordinate
u.nabiuse plot::Scale; let s = Scale::Symlog { base: 10.0, linthresh: 2.0 }; assert((s.inverse(s.forward(-300.0)) + 300.0).abs() < 1e-9);Whether
vcan be shown on this scale.nabiassert(!plot::Scale::Log(10.0).accepts(-1.0) && plot::Scale::Linear.accepts(-1.0));