Coordinate scaling between data space and canvas space.
A Scale maps a closed interval in the data domain onto a pixel range on the
output canvas. linear/2 and log/2 are the two supported scale families.
The plotting pipeline holds one scale per axis on each Bland.Figure, and
series use project/2 to translate data tuples into pixel coordinates.
iex> s = Bland.Scale.linear({0.0, 10.0}, {40.0, 440.0})
iex> Bland.Scale.project(s, 5.0)
240.0
Summary
Functions
Derives a reasonable data-space domain from a list of numbers by padding
padding * span on each end. Zero-span inputs get ±1 padding so the
resulting scale never collapses to a point.
Inverse of project/2. Converts a canvas-space coordinate back to data-space.
Builds a linear scale mapping domain to range.
Builds a log-base scale. base defaults to 10. Both domain endpoints must be > 0.
Projects a data-space value into canvas-space.
Types
Functions
Derives a reasonable data-space domain from a list of numbers by padding
padding * span on each end. Zero-span inputs get ±1 padding so the
resulting scale never collapses to a point.
Inverse of project/2. Converts a canvas-space coordinate back to data-space.
Builds a linear scale mapping domain to range.
Builds a log-base scale. base defaults to 10. Both domain endpoints must be > 0.
Projects a data-space value into canvas-space.