Public
Edited
Oct 19, 2022
1 star
Insert cell
Insert cell
stemAndLeafPlot(data)
Insert cell
// Try changing these values!
// They do not need to be in order.
data = [28, 32, 41, 43, 43, 43, 44, 47, 47, 49, 50, 51, 51, 52, 53, 53, 53, 54, 54, 54, 54, 55, 56, 56, 58, 59, 69, 69, 69, 73, 79, 79, 83, 85, 112, 118, 137]
Insert cell
salp = stemAndLeafPlot
Insert cell
// All integers in the interval [0, 99]
salp(d3.range(100))
Insert cell
// A normal distribution of N integers in the interval [0, 99]
salp(normal)
Insert cell
Insert cell
normal = {
const r = d3.randomNormal(),
A = d3.range(N).map(r),
s = d3.scaleLinear().domain(d3.extent(A)).rangeRound([0, 99]);
return A.map(s);
}
Insert cell
// A random uniform distribution of 100 integers in the interval [0, 99]
salp(d3.range(100).map(n => Math.round(99 * d3.randomUniform()(n))))
Insert cell
Insert cell
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more