Stem-and-Leaf Diagrams

AS · S1 · 14 min

A stem-and-leaf diagram sorts a small set of raw data into order while keeping every value visible. It looks like a bar chart turned on its side, so you see the shape of the distribution, and because the values are in order you can read off the median and quartiles exactly. On Paper 5 you are asked to draw them (including back-to-back diagrams for two data sets), to read medians and quartiles from them, and to use them to compare two groups.

How the diagram works

Split each value into a stem (the leading digit or digits) and a leaf (the final digit). Values with the same stem share a row, and the leaves are written in a line to the right of the stem.

For the value 4747: stem 44, leaf 77. For 132132: stem 1313, leaf 22. For 5.85.8: stem 55, leaf 88.

Definition

A stem-and-leaf diagram displays raw data by writing each value as a stem and a single-digit leaf. In an ordered stem-and-leaf diagram the leaves in each row are in increasing order. A key states what a stem and leaf represent, including units, for example "4 ∣ 74\,|\,7 represents 47 kg47\ \text{kg}".

Three rules make a diagram correct.

  1. Every leaf is one digit. If the data have three significant figures, the stem carries two of them.
  2. The leaves are ordered, smallest next to the stem. Examiners almost always require an ordered diagram; an unordered one usually loses a mark.
  3. There is a key with units. Without a key, "4 ∣ 74\,|\,7" could mean 4747, 4.74.7 or 470470. A missing key is the single most common lost mark on this topic.

Leaves should be lined up in columns, evenly spaced, so the length of each row shows how many values it holds. That is what lets the diagram show shape.

Method
  1. Choose the stems so there are roughly 55 to 1010 rows. Write them in a column, in increasing order downwards, including any stems with no leaves.
  2. Go through the data once, writing each leaf against its stem (an unordered diagram).
  3. Redraw with the leaves in each row in increasing order.
  4. Count the leaves and check the total equals the number of data values.
  5. Write a key with units.

Reading the median and quartiles

Because the values are in order, you count along the leaves.

Key result

For nn ordered values:

  • Median: the n+12\tfrac{n+1}{2}th value. If nn is even this is halfway between the two middle values.
  • Lower quartile Q1Q_1: the median of the lower half of the data.
  • Upper quartile Q3Q_3: the median of the upper half of the data.
  • If nn is odd, the median itself is left out of both halves.
  • Range == largest −- smallest; interquartile range =Q3−Q1= Q_3 - Q_1.

For example, with n=15n = 15 the median is the 88th value, the lower half is values 11 to 77 so Q1Q_1 is the 44th, and the upper half is values 99 to 1515 so Q3Q_3 is the 1212th. With n=16n = 16 the median is halfway between the 88th and 99th values, the lower half is values 11 to 88 so Q1Q_1 is halfway between the 44th and 55th, and Q3Q_3 is halfway between the 1212th and 1313th.

Tip

When counting, write running totals down the right-hand side of the diagram (a cumulative count for each row). Then "the 1212th value" is found instantly: it is in the first row whose running total reaches 1212.

Shape

Turn the diagram so the stems run along the bottom and you have a bar chart of the data. A diagram whose rows are longest near the top (small values) with a long tail of short rows towards larger values is positively skewed. Longest rows near the bottom with a tail towards small values is negatively skewed. Roughly equal tails either side of a central bulge is symmetrical. You will meet skew properly in the box-and-whisker note.

Back-to-back diagrams

To compare two data sets, share one column of stems and put one set's leaves on the right and the other's on the left. The left-hand leaves are ordered outwards from the stem, so on the left the smallest leaf is next to the stem and the leaves get bigger as you read leftwards.

The key must explain both sides, for example "7 ∣ 4 ∣ 27\,|\,4\,|\,2 represents 4747 marks for Group A and 4242 marks for Group B". Reading the left side backwards is the classic error, so read it slowly: on the left of stem 44, leaves written as "7 5 17\ 5\ 1" represent 4141, 4545 and 4747.

Worked examples

Drawing an ordered diagram (routine)

The masses, in grams, of 1616 tomatoes are:

62, 75, 58, 81, 69, 73, 66, 59, 70, 84, 77, 64, 68, 71, 79, 6662,\ 75,\ 58,\ 81,\ 69,\ 73,\ 66,\ 59,\ 70,\ 84,\ 77,\ 64,\ 68,\ 71,\ 79,\ 66

(a) Draw an ordered stem-and-leaf diagram. (b) Find the median and the interquartile range.

Solution

(a)

StemLeavesRunning total
558  98\ \ 922
662  4  6  6  8  92\ \ 4\ \ 6\ \ 6\ \ 8\ \ 988
770  1  3  5  7  90\ \ 1\ \ 3\ \ 5\ \ 7\ \ 91414
881  41\ \ 41616

Key: 6 ∣ 26\,|\,2 represents 62 g62\ \text{g}.

(b) n=16n = 16, so the median is halfway between the 88th and 99th values: 69+702=69.5 g\tfrac{69 + 70}{2} = 69.5\ \text{g}.

Lower half: values 11 to 88. Q1Q_1 is halfway between the 44th and 55th: 64+662=65 g\tfrac{64 + 66}{2} = 65\ \text{g}.

Upper half: values 99 to 1616. Q3Q_3 is halfway between the 1212th and 1313th: 75+772=76 g\tfrac{75 + 77}{2} = 76\ \text{g}.

Interquartile range =76−65=11 g= 76 - 65 = 11\ \text{g}.

Three-figure data

The masses, in grams, of 1414 apples are:

132, 145, 128, 151, 139, 147, 136, 154, 129, 142, 138, 160, 133, 149132,\ 145,\ 128,\ 151,\ 139,\ 147,\ 136,\ 154,\ 129,\ 142,\ 138,\ 160,\ 133,\ 149

Draw an ordered stem-and-leaf diagram and find the median, the quartiles and the range.

Solution

Leaves must be single digits, so the stems are 12,13,14,15,1612, 13, 14, 15, 16.

StemLeavesRunning total
12128  98\ \ 922
13132  3  6  8  92\ \ 3\ \ 6\ \ 8\ \ 977
14142  5  7  92\ \ 5\ \ 7\ \ 91111
15151  41\ \ 41313
1616001414

Key: 13 ∣ 213\,|\,2 represents 132 g132\ \text{g}.

n=14n = 14. Median: halfway between the 77th and 88th values, 139+1422=140.5 g\tfrac{139 + 142}{2} = 140.5\ \text{g}.

Lower half is values 11 to 77: Q1Q_1 is the 44th value, 133 g133\ \text{g}. Upper half is values 88 to 1414: Q3Q_3 is the 1111th value, 149 g149\ \text{g}.

Range =160−128=32 g= 160 - 128 = 32\ \text{g}.

Back-to-back comparison (exam style)

The marks of 1515 students in Group A and 1515 students in Group B are shown.

Group AGroup B
442299
7  5  17\ \ 5\ \ 1333  83\ \ 8
8  6  2  28\ \ 6\ \ 2\ \ 2440  2  4  7  9  90\ \ 2\ \ 4\ \ 7\ \ 9\ \ 9
8  5  3  18\ \ 5\ \ 3\ \ 1553  5  73\ \ 5\ \ 7
4  04\ \ 0660  20\ \ 2
887711

Key: 5 ∣ 3 ∣ 85\,|\,3\,|\,8 represents 3535 marks for Group A and 3838 marks for Group B.

(a) Find the median and interquartile range for each group. (b) Make two comparisons between the marks of the two groups.

Solution

Reading Group A (leaves outwards from the stem): 24,31,35,37,42,42,46,48,51,53,55,58,60,64,7824, 31, 35, 37, 42, 42, 46, 48, 51, 53, 55, 58, 60, 64, 78.

Reading Group B: 29,33,38,40,42,44,47,49,49,53,55,57,60,62,7129, 33, 38, 40, 42, 44, 47, 49, 49, 53, 55, 57, 60, 62, 71.

(a) n=15n = 15 for each, so the median is the 88th value, Q1Q_1 the 44th and Q3Q_3 the 1212th.

Group A: median 4848, Q1=37Q_1 = 37, Q3=58Q_3 = 58, IQR =21= 21.

Group B: median 4949, Q1=40Q_1 = 40, Q3=57Q_3 = 57, IQR =17= 17.

(b) The medians are almost the same (4848 and 4949), so on average the two groups scored similarly, with Group B very slightly higher. Group A's marks are more spread out: its IQR (2121) is larger than Group B's (1717), so Group B's marks are more consistent.

A misrecorded value

For the data set 34,41,45,47,52,52,56,58,61,63,65,68,70,74,8834, 41, 45, 47, 52, 52, 56, 58, 61, 63, 65, 68, 70, 74, 88 (Group P, 1515 marks):

(a) Find the median and interquartile range. (b) It is discovered that the mark 8888 should have been 4848. Find the corrected median and interquartile range, and explain why the median changes.

Solution

(a) Median == 88th value =58= 58. Q1=Q_1 = 44th =47= 47. Q3=Q_3 = 1212th =68= 68. IQR =68−47=21= 68 - 47 = 21.

(b) The corrected ordered data are 34,41,45,47,48,52,52,56,58,61,63,65,68,70,7434, 41, 45, 47, 48, 52, 52, 56, 58, 61, 63, 65, 68, 70, 74.

Median == 88th =56= 56. Q1=Q_1 = 44th =47= 47. Q3=Q_3 = 1212th =65= 65. IQR =65−47=18= 65 - 47 = 18.

The median changes because the corrected value has moved from above the median to below it, which shifts every value in the upper half down one place. If 8888 had been corrected to, say, 8080, it would still be above the median and the median would be unchanged.

Finding missing leaves (exam-hard)

The times, in minutes, taken by 1111 people to complete a puzzle are shown in an ordered stem-and-leaf diagram, where aa and bb are unknown digits.

StemLeaves
112  5  82\ \ 5\ \ 8
220  3  a  70\ \ 3\ \ a\ \ 7
331  5  b1\ \ 5\ \ b
4422

Key: 2 ∣ 32\,|\,3 represents 2323 minutes.

The median time is 2525 minutes and the mean time is 2626 minutes.

(a) Find aa and bb. (b) Find the interquartile range.

Solution

(a) n=11n = 11, so the median is the 66th value. Counting: 12,15,18,20,2312, 15, 18, 20, 23 are the first five, so the 66th is 20+a20 + a. Hence 20+a=2520 + a = 25, giving a=5a = 5.

The total of the times is 11×26=28611 \times 26 = 286.

The known values sum to 12+15+18+20+23+25+27+31+35+42=24812 + 15 + 18 + 20 + 23 + 25 + 27 + 31 + 35 + 42 = 248, and the remaining value is 30+b30 + b. So

248+30+b=286⇒b=8.248 + 30 + b = 286 \quad\Rightarrow\quad b = 8.

Check the order: in row 33 the leaves are 1,5,81, 5, 8, which are increasing, so b=8b = 8 is consistent.

(b) The data are 12,15,18,20,23,25,27,31,35,38,4212, 15, 18, 20, 23, 25, 27, 31, 35, 38, 42. Q1Q_1 is the median of the lower five values (33rd value) =18= 18, and Q3Q_3 is the median of the upper five (99th value) =35= 35. IQR =35−18=17= 35 - 18 = 17 minutes.

Watch out

Reading the left-hand side of a back-to-back diagram the wrong way. On the left, the leaf next to the stem is the smallest. Leaves "8  6  2  28\ \ 6\ \ 2\ \ 2" on the left of stem 44 mean 42,42,46,4842, 42, 46, 48 (so when counting up to a median you meet 4242 first, reading leftwards from the stem), and they certainly do not mean 84,64,…84, 64, \dots. Use the key to check one value before reading the rest.

Watch out

Counting the median from the stems. The median is the middle value, found by counting leaves, not the middle stem. A row with no leaves still has to appear in the diagram, but contributes nothing to the count.

Watch out

Uneven spacing. If one row's leaves are cramped and another's spread out, the diagram misrepresents the shape. Line the leaves up in columns.

Exam tip
  • Always write the key, with units, even if the question does not explicitly ask for one. For a back-to-back diagram the key must explain both sides.
  • "Draw a stem-and-leaf diagram" means an ordered diagram unless told otherwise.
  • When the question gives the stems (for example "use a stem of 11 and a leaf of 0.10.1"), you must use them.
  • Show which positions you used ("Q3Q_3 is the 1212th value") so method marks are available even if you miscount.
  • Comparisons must be in context and must mention both an average and a spread: "Group B's marks were higher on average (median 4949 against 4848) and less spread out (IQR 1717 against 2121)."
Summary
  • Each value splits into a stem and a single-digit leaf; leaves are ordered and evenly spaced.
  • A key with units is compulsory; a back-to-back key explains both sides.
  • Left-hand leaves in a back-to-back diagram increase away from the stem.
  • Median: the n+12\tfrac{n+1}{2}th value. Quartiles: medians of the lower and upper halves (leaving out the median when nn is odd).
  • The diagram keeps all the raw data and shows shape; it is best for small data sets and for comparing two small sets.
  • A changed value only moves the median if it crosses from one side of the median to the other.

Practice questions

Question
  1. The ages, in years, of 1515 people at a meeting are: 23,37,41,18,29,35,44,26,31,38,22,47,33,29,4023, 37, 41, 18, 29, 35, 44, 26, 31, 38, 22, 47, 33, 29, 40. Draw an ordered stem-and-leaf diagram and find the median, quartiles and range.
  2. The lengths, in cm, of 1616 leaves are: 3.2,3.5,3.8,4.0,4.1,4.4,4.4,4.7,4.9,5.0,5.3,5.6,5.8,6.1,6.5,7.23.2, 3.5, 3.8, 4.0, 4.1, 4.4, 4.4, 4.7, 4.9, 5.0, 5.3, 5.6, 5.8, 6.1, 6.5, 7.2. Draw a stem-and-leaf diagram with a suitable key, and find the median and the interquartile range.
  3. In a back-to-back stem-and-leaf diagram the key reads "3 ∣ 6 ∣ 13\,|\,6\,|\,1 represents 6.36.3 seconds for team X and 6.16.1 seconds for team Y". On the left of stem 77 the leaves are written "9  4  09\ \ 4\ \ 0". Write down the three times they represent, and say which team they belong to.
  4. A stem-and-leaf diagram for 1919 values is shown, where xx and yy are digits.
StemLeaves
332  4  72\ \ 4\ \ 7
440  1  5  8  80\ \ 1\ \ 5\ \ 8\ \ 8
550  x  6  90\ \ x\ \ 6\ \ 9
661  3  y  81\ \ 3\ \ y\ \ 8
770  2  50\ \ 2\ \ 5

Key: 5 ∣ 65\,|\,6 represents 5656. The median is 5252 and the upper quartile is 6464. Find xx and yy, and the interquartile range. 5. The times, in minutes, taken by two groups of 1414 students to finish a task are: Group L: 12,14,19,21,21,25,28,30,33,34,39,41,46,5212, 14, 19, 21, 21, 25, 28, 30, 33, 34, 39, 41, 46, 52. Group R: 20,24,27,29,31,33,33,36,38,40,42,45,47,4920, 24, 27, 29, 31, 33, 33, 36, 38, 40, 42, 45, 47, 49. Draw a back-to-back stem-and-leaf diagram, with Group L on the left. 6. For the data in question 5, find the median and interquartile range of each group and make two comparisons in context. 7. For Group R in question 5, two more students are added with times 1515 and 6060 minutes. Without listing all the data, explain why the median of Group R is unchanged, then find the new quartiles. 8. Give one advantage of the back-to-back stem-and-leaf diagram in question 5 over a pair of box-and-whisker plots, and one advantage of the box plots over the stem-and-leaf diagram.

Answers
  1. Ordered: 18,22,23,26,29,29,31,33,35,37,38,40,41,44,4718, 22, 23, 26, 29, 29, 31, 33, 35, 37, 38, 40, 41, 44, 47.
StemLeaves
1188
222  3  6  9  92\ \ 3\ \ 6\ \ 9\ \ 9
331  3  5  7  81\ \ 3\ \ 5\ \ 7\ \ 8
440  1  4  70\ \ 1\ \ 4\ \ 7

Key: 2 ∣ 32\,|\,3 represents 2323 years. n=15n = 15: median == 88th =33= 33; Q1=Q_1 = 44th =26= 26; Q3=Q_3 = 1212th =40= 40; range =47−18=29= 47 - 18 = 29 years.

  1. Stems 3,4,5,6,73, 4, 5, 6, 7; leaves are tenths.
StemLeaves
332  5  82\ \ 5\ \ 8
440  1  4  4  7  90\ \ 1\ \ 4\ \ 4\ \ 7\ \ 9
550  3  6  80\ \ 3\ \ 6\ \ 8
661  51\ \ 5
7722

Key: 4 ∣ 74\,|\,7 represents 4.7 cm4.7\ \text{cm}. n=16n = 16: median =4.7+4.92=4.8 cm= \tfrac{4.7 + 4.9}{2} = 4.8\ \text{cm}. Q1=4.0+4.12=4.05 cmQ_1 = \tfrac{4.0 + 4.1}{2} = 4.05\ \text{cm} (between 44th and 55th). Q3=5.6+5.82=5.7 cmQ_3 = \tfrac{5.6 + 5.8}{2} = 5.7\ \text{cm} (between 1212th and 1313th). IQR =5.7−4.05=1.65 cm= 5.7 - 4.05 = 1.65\ \text{cm}.

  1. They are on the left, so they belong to team X. Reading outwards from the stem: 7.07.0, 7.47.4 and 7.97.9 seconds.

  2. n=19n = 19: median is the 1010th value. Rows 33 and 44 hold 88 values, so the 1010th is the second leaf in row 55: 50+x=5250 + x = 52, so x=2x = 2. The upper half is values 1111 to 1919, so Q3Q_3 is the 1515th value. Rows 33 to 55 hold 1212 values, so the 1515th is the third leaf in row 66: 60+y=6460 + y = 64, so y=4y = 4 (consistent with order 1,3,4,81, 3, 4, 8). Q1Q_1 is the 55th value =41= 41. IQR =64−41=23= 64 - 41 = 23.

Group LGroup R
9  4  29\ \ 4\ \ 211
8  5  1  18\ \ 5\ \ 1\ \ 1220  4  7  90\ \ 4\ \ 7\ \ 9
9  4  3  09\ \ 4\ \ 3\ \ 0331  3  3  6  81\ \ 3\ \ 3\ \ 6\ \ 8
6  16\ \ 1440  2  5  7  90\ \ 2\ \ 5\ \ 7\ \ 9
2255

Key: 4 ∣ 2 ∣ 74\,|\,2\,|\,7 represents 2424 minutes for Group L and 2727 minutes for Group R.

  1. n=14n = 14: median halfway between the 77th and 88th; Q1Q_1 the 44th; Q3Q_3 the 1111th. Group L: median 28+302=29\tfrac{28 + 30}{2} = 29, Q1=21Q_1 = 21, Q3=39Q_3 = 39, IQR =18= 18. Group R: median 33+362=34.5\tfrac{33 + 36}{2} = 34.5, Q1=29Q_1 = 29, Q3=42Q_3 = 42, IQR =13= 13. Group L took less time on average (median 2929 against 34.534.5 minutes). Group L's times were more varied (IQR 1818 against 1313 minutes), so Group R was more consistent.

  2. One new value (1515) is below the old median and one (6060) is above it, so the two middle values are still 3333 and 3636, now the 88th and 99th of 1616. The median stays 34.534.5. New ordered data: 15,20,24,27,29,31,33,33∣36,38,40,42,45,47,49,6015, 20, 24, 27, 29, 31, 33, 33 \mid 36, 38, 40, 42, 45, 47, 49, 60. Q1=27+292=28Q_1 = \tfrac{27 + 29}{2} = 28; Q3=42+452=43.5Q_3 = \tfrac{42 + 45}{2} = 43.5.

  3. The stem-and-leaf diagram keeps every individual time (and shows the shape of each distribution). The box plots show the medians and quartiles directly, so the averages and spreads of the two groups can be compared at a glance.

How well do you know this?

Builds on

Where this leads

Console

Search notes, courses and tools, or run an action