A median line with an inner and an outer band about it (spec/07 §14), copied from
visualize's Visualize.Shape.PercentileBand: the standard reading of a distribution
over time, Macaw.Draw.Shape.Area and Macaw.Draw.Shape.Line composed with a fixed
output shape (visualize D-28).
x/2 and median/2 are pixel accessors; inner/2 and outer/2 each take a {lo, hi}
pair of pixel accessors, nil clearing the band. The quantiles come in as accessors over
the data: none is computed here. curve/2,3 and defined/2 apply to all three paths.
iex> alias Macaw.Draw.Shape.PercentileBand
iex> PercentileBand.generate(PercentileBand.new(), [{0, 1}])
%{outer: nil, inner: nil, median: nil}generate_path/2 answers %{outer:, inner:, median:}: each band the area of its pair
(y0 = lo, y1 = hi) and the median the line, under one curve and predicate, or nil
when unset. generate/2 writes each as path data. They are drawn outer, inner, median.
Summary
Types
A refusal: faults with their paths.
One entry per path, nil where the band or the median is unset.
Functions
curve(band, type, []).
Sets the curve of every path: {:ok, band} or {:error, faults} (§5.1).
As curve/3, the band itself, raising Macaw.Draw.Error with its faults.
Sets the defined predicate of every path (§1.2); nil clears it.
%{outer:, inner:, median:} of SVG path data, nil where unset.
%{outer:, inner:, median:} of Macaw.Draw.IR.Path, nil where unset.
Sets the inner band, a {lo, hi} pair of accessors; nil clears it.
Sets the median accessor; nil clears it.
A percentile band with x from tuple element 0, nothing else set.
Sets the outer band, a {lo, hi} pair of accessors; nil clears it.
Sets the x accessor: a function, a field, or a number.
Types
@type error() :: {:error, [Macaw.Base.Fault.t()]}
A refusal: faults with their paths.
@type output(path) :: %{outer: path | nil, inner: path | nil, median: path | nil}
One entry per path, nil where the band or the median is unset.
@type t() :: %Macaw.Draw.Shape.PercentileBand{ curve: Macaw.Draw.Shape.Curve.curve_type(), curve_opts: keyword(), defined: (term() -> term()) | nil, inner: {(term() -> term()), (term() -> term())} | nil, median: (term() -> term()) | nil, outer: {(term() -> term()), (term() -> term())} | nil, x: (term() -> term()) | nil }
Functions
curve(band, type, []).
Sets the curve of every path: {:ok, band} or {:error, faults} (§5.1).
As curve/3, the band itself, raising Macaw.Draw.Error with its faults.
Sets the defined predicate of every path (§1.2); nil clears it.
%{outer:, inner:, median:} of SVG path data, nil where unset.
@spec generate_path(t(), [term()]) :: output(Macaw.Draw.IR.Path.t()) | error()
%{outer:, inner:, median:} of Macaw.Draw.IR.Path, nil where unset.
Sets the inner band, a {lo, hi} pair of accessors; nil clears it.
Sets the median accessor; nil clears it.
@spec new() :: t()
A percentile band with x from tuple element 0, nothing else set.
Sets the outer band, a {lo, hi} pair of accessors; nil clears it.
Sets the x accessor: a function, a field, or a number.