histogram
hist(samples, [bins])
Input: samples, bins · Output: no output
What it is
Bins samples (Vec of numbers) into equal-width buckets and renders as bars; bins (integer, positional or bins= keyword) defaults to ceil(sqrt(n)) for n = len(samples).
Overloads
One call shape — this function is not overloaded.
| Code | Input | Output | Description |
hist(samples, [bins]) | samples Vec or numberBins samples (Vec of numbers) into equal-width buckets and renders as bars.bins optionalbins (integer, positional or bins= keyword) defaults to ceil(sqrt(n)) for n = len(samples). | no output | — |
Examples
From the documentation, and run by the build -- the output and the figure below are what the engine actually produced. Simplest first.
group_a = randn(40, seed = 11)
group_b = randn(40, seed = 12) + 0.5
group_c = randn(40, seed = 13) - 0.3
panel(1, 2, 1)
histogram(y, 20)
panel(1, 2, 2)
boxplot(group_a, group_b, group_c)
output
· histogram: figure 57 (6 points, 20 bins)
from plotting
How it works
hist(samples) / hist(samples, bins) bins raw samples into equal-width buckets and renders as bars -- distinct from bar, which takes already-aggregated (x, height) pairs.
From the note above this builtin in the interpreter, where the reasoning was written down as it was built.
See also
hist — documented in the same entry.