A continuous symmetric-log scale, for data spanning orders of magnitude through zero (spec/06 §7).
The transform is S(x) = sign(x) · ln(1 + |x| / c), inverse
S⁻¹(y) = sign(y) · c · (e^|y| − 1), c the constant, above 0: linear near zero and
logarithmic beyond c. Its ticks are the signed decades of the constant and zero, its
nice/1 is Macaw.Draw.Scale.Linear's, and when it clamps it clamps its output to the
range's bounds.
Summary
Functions
The range value of value through the transform, 0.5 of the range when the
transformed domain collapses, clamped to the range's bounds when the scale clamps; nil
for a value that is not a number.
0: a symlog scale has no bandwidth.
Sets clamping of the output to the range; answers the struct.
Sets the transition constant, a number above 0: {:ok, scale}, or
{:error, [{[], {:not_positive, c}}]}.
constant/2, answering the scale or raising Macaw.Draw.Error.
Sets the domain, a two-element list or tuple of numbers, stored as a list.
domain/2, answering the scale or raising Macaw.Draw.Error.
The domain value of a range value, S⁻¹(S(d0) + t · (S(d1) − S(d0))); never clamps.
The default scale: domain [-1, 1], range [0, 1], constant 1.
Macaw.Draw.Scale.Linear.nice/1's domain.
Identity: a symlog scale has no padding.
Sets the range, a two-element list or tuple of numbers, stored as a list.
range/2, answering the scale or raising Macaw.Draw.Error.
The signed decades of the constant and zero inside the domain, ascending: −c · 10^k
below zero, 0 when the domain holds it, c · 10^k above, each side strided to about
count values (spec/06 §7.2). A domain holding no decade answers [].
Types
@type error() :: {:error, [Macaw.Base.Fault.t()]}
A refusal: faults with their paths.
Functions
The range value of value through the transform, 0.5 of the range when the
transformed domain collapses, clamped to the range's bounds when the scale clamps; nil
for a value that is not a number.
0: a symlog scale has no bandwidth.
Sets clamping of the output to the range; answers the struct.
Sets the transition constant, a number above 0: {:ok, scale}, or
{:error, [{[], {:not_positive, c}}]}.
constant/2, answering the scale or raising Macaw.Draw.Error.
Sets the domain, a two-element list or tuple of numbers, stored as a list.
domain/2, answering the scale or raising Macaw.Draw.Error.
The domain value of a range value, S⁻¹(S(d0) + t · (S(d1) − S(d0))); never clamps.
@spec new() :: t()
The default scale: domain [-1, 1], range [0, 1], constant 1.
Macaw.Draw.Scale.Linear.nice/1's domain.
Identity: a symlog scale has no padding.
Sets the range, a two-element list or tuple of numbers, stored as a list.
range/2, answering the scale or raising Macaw.Draw.Error.
The signed decades of the constant and zero inside the domain, ascending: −c · 10^k
below zero, 0 when the domain holds it, c · 10^k above, each side strided to about
count values (spec/06 §7.2). A domain holding no decade answers [].