Function Repository Resource:

StemLeafPlot

Source Notebook

Construct a stem-and-leaf diagram

Contributed by: Wolfram Research

ResourceFunction["StemLeafPlot"][data]

creates a stem-and-leaf plot for the real-valued vector data.

ResourceFunction["StemLeafPlot"][data1,data2]

creates a side-by-side stem-and-leaf plot for the vectors data1 and data2.

Details and Options

ResourceFunction["StemLeafPlot"] displays the distribution of real‐valued numbers as stems and leaves in a tabular form.
Stems are multipliers of a base unit, and leaves are remainders rounded to a given number of digits.
ResourceFunction["StemLeafPlot"] has the same options as GridBox, with the following additions:
"ColumnLabels"Automaticlabels for the columns of the plot
"IncludeEmptyStems"Falsewhether to display stems without leaves
"IncludeStemCounts"Falsewhether to include a column of leaf counts
"IncludeStemUnits"Truewhether stem units should be included
"Leaves""Digits"how leaves are represented
"StemExponent"Automaticstem units given as an integer power of 10

Examples

Basic Examples (2) 

StemLeafPlot of one dataset:

In[1]:=
ResourceFunction["StemLeafPlot"][{1.2, 2.5, 4.1, 1.6, 3.8, 2.6, 2.9}]
Out[1]=

Side‐by‐side StemLeafPlot of two datasets:

In[2]:=
ResourceFunction[
 "StemLeafPlot"][{1.2, 2.5, 4.1, 1.6, 3.8}, {2.3, 2.8, 1.4, 3.6}]
Out[2]=

Options (6) 

ColumnLabels (1) 

StemLeafPlot with stem and leaf columns labeled with "S" and "L":

In[3]:=
ResourceFunction["StemLeafPlot"][{1.2, 2.5, 4.1, 1.6, 3.8, 2.6, 2.9}, "ColumnLabels" -> {"S", "L"}]
Out[3]=

IncludeEmptyStems (1) 

StemLeafPlot including stems that have no leaves:

In[4]:=
ResourceFunction["StemLeafPlot"][{1.2, 2.5, 7.1, 1.6, 2.6, 2.9}, "IncludeEmptyStems" -> True]
Out[4]=

IncludeStemCounts (1) 

Add stem counts to the plot:

In[5]:=
ResourceFunction["StemLeafPlot"][{1.2, 2.5, 4.1, 1.6, 3.8, 2.6, 2.9}, "IncludeStemCounts" -> True]
Out[5]=

IncludeStemUnits (1) 

Omit the stem units legend from the plot:

In[6]:=
ResourceFunction["StemLeafPlot"][{1.2, 2.5, 4.1, 1.6, 3.8, 2.6, 2.9}, "IncludeStemUnits" -> False]
Out[6]=

Leaves (1) 

Represent leaves with tally marks:

In[7]:=
ResourceFunction["StemLeafPlot"][{1.2, 2.5, 4.1, 1.6, 3.8, 2.6, 2.9}, "Leaves" -> "Tallies"]
Out[7]=

StemExponent (1) 

Specify a base unit of 101:

In[8]:=
ResourceFunction["StemLeafPlot"][{1.2, 2.5, 4.1, 1.6, 3.8, 2.6, 11}, "StemExponent" -> 1]
Out[8]=

Requirements

Wolfram Language 11.3 (March 2018) or above

Version History

  • 1.0.0 – 28 March 2019

License Information