A continuous logarithmic scale, for data spanning orders of magnitude (spec/06 §5).
Every logarithm is log(x) / log(base), exact for bases 10 and 2. The domain's bounds
must be positive: one at or below zero is the fault {[i], {:not_positive, value}}. A
value at or below zero has no position on a log axis and applies to nil, as does a
value that is not a number. ticks/2 are d3-scale's log ticks.
Summary
Functions
The range value of a positive value, by t = (log v − log d0) / (log d1 − log d0),
clamped to [0, 1] when the scale clamps; nil for a value at or below zero or not a
number.
0: a log scale has no bandwidth.
Sets clamping; answers the struct.
Sets the domain, both bounds positive: {:ok, scale} or {:error, faults}.
domain/2, answering the scale or raising Macaw.Draw.Error.
The domain value of a range value, base ^ (log d0 + t · (log d1 − log d0)); never clamps.
The default scale, base 10.
A log scale of base, a number above 0 and not 1: {:ok, scale}, or
{:error, [{[], {:log_base, base}}]}.
new/1, answering the scale or raising Macaw.Draw.Error.
The domain extended to integer powers of the base.
Identity: a log scale has no padding.
Sets the range, two numbers: {:ok, scale} or {:error, faults}.
range/2, answering the scale or raising Macaw.Draw.Error.
About count ticks, as d3-scale's log ticks are (spec/06 §5.2).
Types
@type error() :: {:error, [Macaw.Base.Fault.t()]}
A refusal: faults with their paths.
Functions
The range value of a positive value, by t = (log v − log d0) / (log d1 − log d0),
clamped to [0, 1] when the scale clamps; nil for a value at or below zero or not a
number.
0: a log scale has no bandwidth.
Sets clamping; answers the struct.
Sets the domain, both bounds positive: {:ok, scale} or {:error, faults}.
domain/2, answering the scale or raising Macaw.Draw.Error.
The domain value of a range value, base ^ (log d0 + t · (log d1 − log d0)); never clamps.
@spec new() :: t()
The default scale, base 10.
A log scale of base, a number above 0 and not 1: {:ok, scale}, or
{:error, [{[], {:log_base, base}}]}.
new/1, answering the scale or raising Macaw.Draw.Error.
The domain extended to integer powers of the base.
Identity: a log scale has no padding.
Sets the range, two numbers: {:ok, scale} or {:error, faults}.
range/2, answering the scale or raising Macaw.Draw.Error.
About count ticks, as d3-scale's log ticks are (spec/06 §5.2).
Within fewer decades than the count and with an integer base, every k · base^e
(1 ≤ k < base) inside the domain, falling back to Macaw.Draw.Ticks.ticks/3 over the
domain when those number under half the count; otherwise the exponents thinned by the
tick rule at the real count min(j − i, count) and mapped back through the base. A
count at or below zero is read as 1.