62 Probability and Statistical Diagrams🔗ℹ
Small, immutable, addressable diagram groups support common probability and
statistics explanations. These constructors do not analyse data
or add a separate scene protocol: their bars, cells, tree branches, quartile
box, and error-bar elements are ordinary named children that work with existing
paths, colours, transforms, and attention effects.
| (bar-chart | | values | | | | | | | | #:id identifier | | | | | | | [ | #:labels labels | | | | | | | | #:center center | | | | | | | | #:width width | | | | | | | | #:height height | | | | | | | | #:maximum maximum | | | | | | | | #:fill fill | | | | | | | | #:stroke stroke | | | | | | | | #:stroke-width stroke-width | | | | | | | | #:value-labels? value-labels?]) | | → | | group-visual? |
|
| values : (and/c list? pair?) |
| identifier : symbol? |
| labels : (or/c (listof string?) false/c) = #f |
| center : vec2? = origin |
| width : positive-real? = 6 |
| height : positive-real? = 3 |
| maximum : (or/c positive-real? false/c) = #f |
| fill : any/c = "cornflowerblue" |
| stroke : any/c = "navy" |
| stroke-width : nonnegative-real? = 2 |
| value-labels? : boolean? = #t |
Creates a baseline and one upward nonnegative bar per value. Values are scaled
against
maximum, or the largest supplied value (at least one). Labels
and value labels are optional ordinary text children. The path of one bar is
(bar-chart-bar-path identifier index), where indexes start at one.
Counts finite numeric samples into equally wide bins, then returns the same
addressable bar-group shape as
bar-chart. A supplied range is an
increasing pair; samples outside it are omitted and a sample at the upper bound
belongs to the final bin.
Creates one bar per equal-length nonnegative row and stacks each row’s values
from the common baseline. Use
stacked-bar-path and
stacked-bar-segment-path for one bar or segment, with one-based
indexes.
Creates equally sized, coloured cells from a nonnegative rectangular matrix.
Each cell displays its supplied weight. Its path is
(sample-space-cell-path identifier row column), with one-based row and
column indexes; the geometry remains equal even for unequal weights.
Describes one immutable node in a finite probability tree. Branch identities
must be globally unique within one
probability-tree input.
Lays out an explicit finite forest by leaf order. Child edge labels display the
child branch probability. A node can be addressed with
(probability-tree-node-path identifier branch-id).
Creates whiskers, a quartile box, and a median line from at least two values.
Quartiles use deterministic linear interpolation between sorted observations;
outliers are not inferred or displayed.
box-plot-summary is the
transparent five-number summary structure used by the constructor.
Describes a point with symmetric vertical error.
Creates addressable vertical stems, end caps, and point markers. The path for a
one-based point index is
(error-bar-path identifier index).
Returns the path of one one-based bar.
Returns the path of one one-based stacked bar.
Returns the path of one one-based stacked-bar segment.
Returns the path of one one-based sample-space cell.
Returns the path of one named probability-tree node.
The deterministic five-number summary used by
box-plot.
Returns the path of one one-based error-bar group.
See "examples/probability-and-statistics.rkt" for one composition that
uses chart, finite-outcome, tree, distribution, and uncertainty views together.
}
Reference · Visuals