# scales v0.1.0 - API Reference

## Modules

- [Scales](Scales.md): R's scales package for Elixir: the pieces a chart's scales are built from, as plain functions
of values, for any charting tool. Each gives the answer R's scales 1.4.0 gives, to the last
digit; where one departs from R, its documentation says how and why.
- [Scales.Bounds](Scales.Bounds.md): Values against the bounds of a range: values moved from one range to another (`rescale/3`,
`rescale_mid/4`, `rescale_max/3`, or not at all, `rescale_none/1`), whether a range is zero
wide (`zero_range?/1`), a range widened at its ends (`expand_range/2`), and what is done with
values outside a range, R's `oob_*` family: censored (`censor/2`, `censor_any/2`), squished
onto its ends (`squish/2`, `squish_any/2`, `squish_infinite/2`), dropped (`discard/2`) or kept
(`keep/2`).
- [Scales.Breaks](Scales.Breaks.md): Where a continuous axis's breaks go, given its limits: evenly spaced numbers, nice to read, that
cover them (`extended/2`), round steps that cover them (`pretty/2`), or every multiple of a
width (`fullseq/3`), moved by an offset (`width/3`), between numbers, dates, date-times or
times of day; powers of a base and their
multiples for a logarithmic axis (`log/2`), whole numbers for an axis of exponentials
(`exp/2`), and whole seconds, minutes, hours, days or weeks for spans of time (`timespan/2`).
The breaks may fall outside the limits; which to keep is the caller's.

- [Scales.ColorOperations](Scales.ColorOperations.md): Colours as a user writes them and as R's palettes make them: a colour read as CSS reads one
(`parse/1`); one made from a hue, chroma and luminance (`from_hcl/3`) or from CIE L*a*b*
(`from_lab/2`), and a colour's L*a*b* (`to_lab/1`) and alpha (`opacity/1`), each exactly as R's
farver makes it; two mixed (`mix/3`), R's `col_mix()`; one changed, R's colour helpers: its
alpha set (`alpha/2`), its hue, chroma or luminance set (`with_hcl/2`, `muted/2`), made
lighter, darker or more saturated (`lighter/2`, `darker/2`, `saturate/2`) or its hue turned
(`shift/2`); and the viridis palettes' colours (`viridis/2`), R's `viridisLite::viridis()`.
- [Scales.DataRange](Scales.DataRange.md): The range of the data a scale has seen, trained a batch of values at a time: a continuous range,
the lowest and highest finite number (`train_continuous/2`), or a discrete one, the levels seen,
in order (`train_discrete/3`); with the key that orders values that have no levels of their own
(`level_key/1`) and the key a value is matched by (`key/1`).
- [Scales.Labels](Scales.Labels.md): Labels for a scale's breaks: numbers written plainly (`plain/1`), in decimals (`number/2`),
with a comma between thousands (`comma/2`), as percentages (`percent/2`), as amounts of money
(`currency/2`), in scientific notation (`scientific/2`), in whichever way suits their size
(`number_auto/1`), as powers (`log/2`, or as text, `format_log/2`), as bytes (`bytes/2`), as
ordinals (`ordinal/2`), as p-values (`pvalue/2`), as spans of time (`timespan/2`), and dates,
date-times and times of day in a format (`date/2`, `time/2`) or by what changed from the break
before (`date_short/2`); and text broken into lines (`wrap/2`) or looked up in a dictionary
(`dictionary/2`).
- [Scales.MinorBreaks](Scales.MinorBreaks.md): Where a continuous axis's minor breaks go: between its breaks (`regular/3`), a number of them to
each gap (`n/3`) or every multiple of a width in each (`width/4`), and the powers of ten and
their multiples for a logarithmic axis (`log/2`).

- [Scales.Palette](Scales.Palette.md): Palettes: what turns a value's place among the data into a value of its aesthetic, a colour, a
size, a shape or a line type. A palette is a value naming its function, so it compares and
prints. A continuous palette is handed places, 0 to 1 over the data's range (`continuous/2`); a
discrete one the number of levels it must tell apart (`discrete/2`).
- [Scales.Transform](Scales.Transform.md): The transformation a continuous scale puts its values through before it trains on them, named
by a value (`t:name/0`): values into transformed space (`transform/2`) and back
(`inverse/2`), and an axis's default breaks (`breaks/3`), minor breaks (`minor_breaks/3`) and
labels (`format/3`) there, as R's transformation objects carry them; for a transformation of
numbers, also the derivatives both ways (`derivative/2`, `inverse_derivative/2`) and the range
data takes in transformed space (`trim_to_domain/2`).

