Stem-and-Leaf Builder

Builds a stem-and-leaf plot from editable data. The learner picks the stem's place value, splits stems into two lines (leaves 0-4 and 5-9), places values one at a time and sorts the leaves, or turns the plot on its side to see a histogram that still keeps every digit. Clicking a leaf reads back the value it stands for.

Used in: Introduction to Statistics

Props

PropTypeDefaultDescription
titlestringStem-and-leaf plotCard title.
datanumber[][52, 55, 61, 63, 64, 68, 70, 71, 74, 79, 83]The data values, in the order they were recorded (up to 300; negatives allowed, shown on '−' stems). Build mode places them in this order.
stemUnitnumber(auto: the finest power of ten giving at most 15 stems)Place value of the stem, a power of ten: 10 = stem tens / leaf ones, 1 = stem ones / leaf first decimal place, 100 = stem hundreds / leaf tens. The leaf is the next digit (stemUnit / 10); lower digits are truncated (see leafRounding). The learner can change it.
splitbooleanfalseTwo lines per stem: leaves 0-4 on the first line and 5-9 on the second; every stem in range gets both lines (empty ones kept). The learner can toggle it.
captionstring(none)Data set name shown above the plot, e.g. 'Resting Heart Rates of BSU Students'.
keyStylestringbothKey under the plot: 'places' = 'Stem: Tens / Leaf: Ones' (slide style), 'value' = 'Key: 5 | 2 = 52' (smallest value), 'both', or 'none'.
stemLabelstring(from stemUnit, e.g. 'Tens')Override the stem's place name in the key.
leafLabelstring(from stemUnit, e.g. 'Ones' or 'First decimal place')Override the leaf's place name in the key.
modestringplot'plot' shows the finished plot. 'build' starts empty: the learner places the values one at a time in data order (each leaf lands on its stem's line, unsorted), then sorts the leaves.
placednumber0Build mode only: how many values are already placed at the start (0 to n).
viewstringplot'plot' = stems down the side; 'sideways' = turned on its side so the leaf columns stand up like histogram bars. Ignored with compareData.
viewTogglebooleantrueShow the Plot / Sideways switch in the title bar.
controlsstring[] | booleanall controls shownIds of the hideable controls to show (see the controls registry: toggle.stem-unit, toggle.split, toggle.counts, toggle.view); core controls always show. Omit to show everything. Fitted per page by component_scopes.py, not by hand. Legacy boolean: false hides the stem-unit choice, the two-lines-per-stem switch and the counts switch (a fixed display); true = omitted. Starting states (split, showCounts, view) still apply when their switch is hidden.
editablebooleantrueLet the learner replace the data (comma- or space-separated numbers).
showCountsbooleanfalseShow the number of leaves on each line (its frequency). The learner can toggle it.
showDataboolean(true when editable or in build mode)Show the raw data as clickable chips above the plot (clicking one highlights its leaf).
compareDatanumber[](none)A second group for a back-to-back plot: its leaves run leftward from the shared stems (smallest next to the stem), `data` runs rightward.
dataLabelstring(none)Name of the `data` group (right side of a back-to-back plot).
compareLabelstring(none)Name of the `compareData` group (left side).
leafRoundingstringtruncateHow digits below the leaf are handled: 'truncate' (drop them; textbook default) or 'round'. A note appears when any value loses digits.