The Stem-and-Leaf Plot was popularised by Tukey (1977) as part of his toolkit for Exploratory Data Analysis.
61.1 Definition
The Stem-and-Leaf Plot describes the distribution of a univariate data set while preserving (at least) two digits (after any chosen rounding) of the original observations. The plot is generated by extracting the so-called “leaf” (usually the last digit) and “stem” (usually the leading digits) of each observation. If the data contain a lot of digits, it may be necessary to round the data to a particular place value. The values of the observation are printed (in ascending order) in the format “stem | leaf1 leaf2 leaf3…” where all observations with the same stem are aligned in the same row (the common stem is only printed once).
61.2 Horizontal axis
There is no conventional horizontal axis in a stem-and-leaf plot. Each leaf is represented by one digit (observations with the same stem are aligned in the same row, placing the digits next to each other, going from left to right). Each leaf digit represents the last digit of a single observation, and the number of leaves in a row reflects the frequency of observations with that stem.
61.3 Vertical axis
The vertical axis is oriented from top to bottom (pointing downwards) and represents the values of the variable under investigation.
61.4 R Module
61.4.1 Public website
The Stem-and-Leaf Plot can be found on the public website:
The Stem-and-Leaf Plot is available under the “Descriptive / Stem-and-Leaf Plot” menu item.
If you prefer to compute the Stem-and-Leaf Plot on your local computer, the following code snippet can be used in the R console:
x <-rnorm(250,3,2)par1 <-1#scalepar2 <-80#widthpar3 <-1e-08#tolerancestem(x,par1,par2,par3)
The decimal point is at the |
-3 | 5
-2 |
-1 | 00
-0 | 887442210
0 | 0123345556777889999
1 | 0001112223333444444556677777888899999
2 | 000000001123334455555555666666677777778888999999
3 | 000111111112222222222333444444555556667788889999
4 | 00111233344444445555666777788888999
5 | 0001111112233334445556777899
6 | 001123334444667888
7 | 0022
8 | 1
To create a Stem-and-Leaf Plot, the R code uses the stem function to produce the plot in the form of printed characters in the console. The dataset is simulated with the rnorm function as a series of random numbers (N = 250) from the Normal Distribution with a mean of 3 and a standard deviation of 2.
61.5 Purpose
The Stem-and-Leaf Plot can be used to graphically examine the distribution of the data. The following properties of the distribution can be visualized by this plot: central tendency, variability, skewness, modality, and the presence of outliers.
61.6 Pros & Cons
61.6.1 Pros
The Stem-and-Leaf Plot has the following advantages:
The original data are still available (up to a rounding error). This is not the case with the Histogram from Chapter 62.
It is relatively easy to interpret and conveys a lot of information in a simple graph.
Many readers are familiar with Stem-and-Leaf Plots.
61.6.2 Cons
The Stem-and-Leaf Plot has the following disadvantages:
The amount of information that is conveyed depends on how the stem is defined. Badly performed extractions of stems and leaves may result in plots where distributional features (such as multi modality, central tendency, variability, etc.) are concealed.
In the presence of outliers, the Stem-and-Leaf Plot may not be very informative. Trimming the outliers from the dataset may be necessary to solve this problem.
61.7 Example
The Stem-and-Leaf Plot displays decimal digits of each observation in an ordered form (from small to large). The first digit(s) are displayed in a vertical column and the following digit is displayed at the right of this column. This plot looks very similar to a bus stop schedule: the first column displays the hour of departure and the right side of the plot displays the minutes after the hour. For example, if there are five bus departures (at 10:20, 10:40, 17:10, 17:30, and 17:50) then the schedule could be displayed as:
Hours Minutes after the hour
10 20 40
17 10 30 50
Similarly, it is possible to represent any univariate, quantitative variable by splitting each observation into its “first digit(s)” and the “following digit” (ignoring any remaining digits). The following example shows the Monthly Marriages:
Compute the Stem-and-Leaf Plot for the time that students need to submit a survey. Hint: you can find the data as is explained in Chapter 54. What happens if you use the trimming slider?
Tukey, John W. 1977. Exploratory Data Analysis. Reading, MA: Addison-Wesley.