Skip to main content
v2026.11,858 entries · CC-BY 4.0

Stemplot With Decimals: How to Make One, Step by Step

How to make a stemplot with decimals: choose stems and leaves, handle values below 1, round or truncate, write the key, and build it in R, Python or Excel.

Written and maintained by CASRAI Editorial Board

Last updated

A stemplot with decimals splits every value into a stem (everything except the last digit you keep) and a leaf (that last digit). For data such as 3.4 the stem is 3 and the leaf is 4; for data such as 0.58 the stem is 0.5 and the leaf is 8. The part people get wrong is not the splitting but the bookkeeping: choosing how many decimals the plot keeps, deciding whether longer values are rounded or cut, handling values below 1, and writing a key so the reader knows where the decimal point sits. This guide covers those decisions with worked arithmetic and short code.

What a stemplot with decimals is

A stemplot (stem-and-leaf plot) is a text-based display of a small numeric data set. In the OpenStax Introductory Statistics text, each observation is divided into a stem and a leaf, and the leaf consists of a final significant digit. Stems are listed vertically from smallest to largest, and the leaves go to the right of their stem in increasing order. The same text gives the decimal case directly: the decimal 9.3 has stem nine and leaf three, while the number 432 has stem 43 and leaf two.

So a stemplot with decimals is the same device applied to values such as 9.3 or 0.58. The decimal point is not drawn in the plot. It is carried by the key, which is why the key is not optional.

How to make a stemplot with decimals, step by step

  1. Decide how many decimals the plot keeps. Keep the precision of your measurements, but no more than the leaf can hold: one digit. If your data have one decimal (3.4), the whole number is the stem and the tenths digit is the leaf. If your data have two decimals (0.58), the stem is the whole number plus the first decimal (0.5) and the leaf is the second decimal (8).
  2. Sort the data from smallest to largest.
  3. List every stem from the smallest to the largest value, including empty ones. A stem with no leaves still gets a row, otherwise the gap in the data disappears from the picture.
  4. Write each leaf to the right of its stem, in increasing order, one digit per leaf and every observation written out (repeated values repeat the leaf).
  5. Add a key that shows one value decoded, for example “2 | 3 means 2.3”.
  6. Count the leaves and check the total equals n.

Worked example 1: one decimal

This is an illustrative data set invented for this guide, n = 12: 1.2, 1.5, 2.3, 2.3, 2.7, 3.1, 3.4, 3.4, 3.9, 4.0, 4.6, 5.2. The stem is the whole number and the leaf is the tenths digit.

1 | 2 5
2 | 3 3 7
3 | 1 4 4 9
4 | 0 6
5 | 2

Key: 2 | 3 means 2.3

Leaf count: 2 + 3 + 4 + 2 + 1 = 12, which equals n. The shape is mildly right-skewed: the longest rows are at stems 2 and 3, with a thin tail up to 5.2.

Summary values read straight off the plot: the minimum is 1.2, the maximum is 5.2 and the range is 5.2 − 1.2 = 4.0. With 12 values the median is the mean of the 6th and 7th values, which are 3.1 and 3.4, so the median is (3.1 + 3.4) / 2 = 3.25. The sum is 37.6, so the mean is 37.6 / 12 ≈ 3.13. The most frequent values are 2.3 and 3.4, each appearing twice.

Worked example 2: two decimals and values below 1

Again an illustrative data set, n = 11: 0.42, 0.47, 0.51, 0.58, 0.58, 0.63, 0.69, 0.74, 0.81, 0.85, 0.92. All values are below 1, so using the whole number as the stem would put everything in one row labelled 0. Instead the stem is the first decimal (tenths) and the leaf is the second (hundredths):

4 | 2 7
5 | 1 8 8
6 | 3 9
7 | 4
8 | 1 5
9 | 2

Key: 4 | 2 means 0.42

Leaf count: 2 + 3 + 2 + 1 + 2 + 1 = 11. The median is the 6th of 11 values, 0.63, and the mode is 0.58. The key does the work here: without it, “4 | 2” could be read as 4.2 or 42.

Rounding or truncating longer values

A leaf holds one digit, so data with more decimals than the plot keeps must be shortened first. There are two ways, and they can give different pictures. Take eight values with two decimals and show them to one decimal: 2.34, 2.38, 2.41, 2.46, 2.49, 2.55, 2.58, 2.63.

Method Leaves under stem 2 How each value is treated
Truncate (drop the extra digit) 3 3 4 4 4 5 5 6 2.34 and 2.38 both become 2.3; 2.41, 2.46, 2.49 all become 2.4
Round to nearest tenth 3 4 4 5 5 6 6 6 2.34 becomes 2.3 but 2.38 becomes 2.4; 2.55 and 2.58 become 2.6 along with 2.63

Both are legitimate, but they are different plots of the same data, so pick one rule, apply it to every value and say which one you used next to the key (for example “values truncated to one decimal”). If the data are precise enough to matter, use the two-decimal split from example 2 instead of shortening them.

Reading the plot

What you see What it tells you
Longest row of leaves Where the values cluster (the modal stem)
Long thin tail on one side Skew toward that side; see the guide on left- vs right-skewed distributions
Isolated leaf far from the rest A possible outlier to check against the raw data
Empty stem between filled stems A gap in the data
First and last stem Minimum and maximum, so the range

Because every observation is written out, a stemplot keeps the raw values, which a histogram does not. That makes it a quick check before computing the numbers in descriptive statistics, such as the median and the five-number summary.

Assumptions and common mistakes

  • Missing or ambiguous key. The decimal point is invisible in a stemplot. Always decode one value.
  • Dropping empty stems. Skipping a stem with no leaves compresses the gap and misrepresents the shape.
  • Leaves out of order. Unsorted leaves make the median and quartiles hard to read.
  • Mixed precision. Mixing 3.4 with 3.45 in one plot forces you to round or truncate silently. Decide on one rule first.
  • Using the whole number as the stem when all values share it. Data between 0 and 1 (or between 7.0 and 7.9) need the first decimal as the stem, as in example 2.
  • Negative values. A common convention is to keep the sign on the stem, not the leaf, and give values between −1 and 0 their own stem (−0). Whatever convention you choose, state it in the key.
  • Large data sets. A stemplot suits small to moderate samples; with hundreds of values rows become unreadable and a histogram is the better display.

How to report a stemplot

Treat the stemplot as a figure: give it a number and a descriptive caption, include the key, and state the rounding rule if you shortened values. Then describe what it shows in the text rather than leaving the figure to speak for itself. A sentence that works for example 1:

Figure 1 shows a stem-and-leaf plot of the 12 observations (stem = whole number, leaf = tenths). Values ranged from 1.2 to 5.2, were concentrated between 2.3 and 3.9, and had a median of 3.25.

Follow the figure and caption rules of the style guide your journal or institution requires; those rules differ between styles and are not covered here.

How to calculate a stemplot in R, Python or Excel

R

Base R has a built-in function. According to the R documentation for stem in the graphics package, the usage is stem(x, scale = 1, width = 80, atom = 1e-08), where x is a numeric vector, scale controls the plot length (scale = 2 makes it roughly twice as long) and infinite and missing values are discarded.

x <- c(1.2, 1.5, 2.3, 2.3, 2.7, 3.1, 3.4, 3.4, 3.9, 4.0, 4.6, 5.2)
stem(x)
stem(x, scale = 2)

R chooses the stem layout itself, so its rows can be split differently from a hand-built plot; read the key it prints. For other base-R displays see histograms in R and box plots in R.

Python

The standard library has no stemplot, but the logic is short. This function rounds half up to the number of decimals you choose (places), then splits the result into stem and leaf; it assumes non-negative values.

from decimal import Decimal, ROUND_HALF_UP
from collections import defaultdict

def stemplot(values, places=1, rounding=ROUND_HALF_UP):
    unit = Decimal(1).scaleb(-places)
    rows = defaultdict(list)
    for v in sorted(values):
        t = int(Decimal(str(v)).quantize(unit, rounding=rounding) * 10**places)
        rows[t // 10].append(t % 10)
    for stem in range(min(rows), max(rows) + 1):
        print(stem, "|", *rows.get(stem, []))

stemplot([1.2,1.5,2.3,2.3,2.7,3.1,3.4,3.4,3.9,4.0,4.6,5.2])
stemplot([0.42,0.47,0.51,0.58,0.58,0.63,0.69,0.74,0.81,0.85,0.92], places=2)

Run on the two example data sets, this prints exactly the plots shown above. Pass rounding=ROUND_DOWN to truncate instead of round. With places=2 the printed stem is the tenths digit, so the key is “4 | 2 means 0.42”.

Excel

Excel has no stemplot chart, so build the stem and leaf in two helper columns from sorted data in column A. For one decimal: put =ROUND(A2*10,0) in B2, the stem in C2 as =INT(B2/10) and the leaf in D2 as =MOD(B2,10). Then list the leaves for each stem across a row. The ROUND removes floating-point noise (2.3 stored as 2.2999…), and it rounds rather than truncates; for truncation of two-decimal data use =INT(ROUND(A2*100,0)/10) in B2 instead. These formulas assume non-negative values.

FAQ

How do you make a stemplot with decimals?

Choose how many decimals to keep, sort the data, make the stem everything before the last kept digit and the leaf that last digit, list all stems including empty ones, and add a key such as “2 | 3 means 2.3”. The numbered steps above give the full sequence.

What is the stem and what is the leaf for 3.4?

For data with one decimal the stem is 3 and the leaf is 4. For data with two decimals, such as 3.45, the stem is 3.4 and the leaf is 5.

How do you make a stemplot when all values are below 1?

Use the first decimal as the stem and the second as the leaf, so 0.42 becomes stem 4, leaf 2, with a key reading “4 | 2 means 0.42” (example 2).

Should I round or truncate values before plotting?

Either is acceptable if applied to every value and stated beside the key; the two can give different leaf patterns for the same data, as the table above shows.

Can a stemplot show the median?

Yes. Because every value is written out in order, count to the middle value (or average the middle two). In example 1 that gives 3.25.

Sources

  • OpenStax, Introductory Statistics, section 2.2, “Stem-and-Leaf Graphs (Stemplots), Line Graphs, and Bar Graphs”, as hosted by LibreTexts: stats.libretexts.org (checked 2026-10-29).
  • R Documentation, stem {graphics}, Stem-and-Leaf Plots: stat.ethz.ch/R-manual (checked 2026-10-29). The page cites Becker, Chambers and Wilks (1988), The New S Language, Chapman and Hall/CRC.

The data sets, worked arithmetic and rounding comparison above are illustrative examples computed for this guide, not data from the sources.

Follow CASRAI

Research-administration guidance, standards updates and independent tool reviews.

Ask CASRAI · free to try

Ask about Stemplot With Decimals: How to Make One, Step by Step

Ask your first 2 questions free below. Subscribers get 150 a day for $29 a month.

An AI assistant specialized in research administration. It cites the sources behind every answer, labels web answers and says when it can't answer.

Answers draw on CASRAI's guides and dictionary plus the federal and funder documents we index: Federal Register, Grants.gov, Regulations.gov and UKRI.

Works on this site and inside Claude, Cursor and the AI tools you already use.

Everything CASRAI publishes — this page, the dictionary, the guides and the news — stays free to read, with no account and no card.

Referenced across the research world

University of Cambridge logoColumbia University logoCrossref logoUniversity of Edinburgh logoHarvard University logoUniversity of Oxford logoPrinceton University logoStanford School of Medicine logoUniversity College London logoORCID logoUniversity of Cambridge logoColumbia University logoCrossref logoUniversity of Edinburgh logoHarvard University logoUniversity of Oxford logoPrinceton University logoStanford School of Medicine logoUniversity College London logoORCID logo
  • University of Cambridge logo
  • Columbia University logo
  • Crossref logo
  • University of Edinburgh logo
  • Harvard University logo
  • University of Oxford logo
  • Princeton University logo
  • Stanford School of Medicine logo
  • University College London logo
  • ORCID logo

View CASRAI adoption →

Ask CASRAI · Regulatory Radar

Research-admin question? Get an answer that links its sources.

An AI assistant specialized in research administration. Every answer links its sources to check before you act. 2 questions free, no account. $29/month after.

  • Answers draw on CASRAI's guides and dictionary plus the federal and funder documents we index: Federal Register, Grants.gov, Regulations.gov and UKRI.
  • Every answer numbers its sources and links each one, so you can check the source yourself.