To demonstrate the construction of dot plots (or dot charts) we will use the data in the example below.
Example: The table below provides data on the approximate number of drug related arrests (in thousands) from 2001 to 2010.
Year | 2001 | 2002 | 2003 | 2004 | 2005 | 2006 | 2007 | 2008 | 2009 | 2010 |
Number of Arrests | 35 | 30 | 29 | 31 | 30 | 31 | 30 | 29 | 32 | 31 |
First we'll need to create a data set.
> arrests = c(35, 30, 29, 31, 30, 31, 30, 29, 32, 31)
To create a dot plot we will use the command dotchart.
> dotchart(arrests)
If we want to add more information to our plot we can include the main and xlab arguments.
> dotchart(arrests, main = "Drug Related Arrests - 2001 to 2010", xlab = "Number of Arrests (in thousands)")
Stem Plots
To demonstrate the construction of stem plots (or stem-and-leaf plots) will use the data in the example below.
Example: The table below provides data on the approximate number of drug related arrests (in thousands) from 2001 to 2010.
Celestial Body | Number of Successful Probes |
Sun | 17 |
Mercury | 3 |
Venus | 27 |
Mars | 24 |
Jupiter | 10 |
Saturn | 3 |
Uranus | 1 |
Neptune | 1 |
Asteroids | 11 |
Comets | 13 |
Moon | 52 |
First we'll need to create a data set.
> probes = c(17, 3, 27, 24, 10, 3, 1, 1, 11, 13, 52)
To create a stem plot we will use the command stem.
> stem(probes)
The decimal point is 1 digit(s) to the right of the |
0 | 11330137
2 | 47
4 | 2
> stem(probes, scale = 2)
The decimal point is 1 digit(s) to the right of the |
0 | 1133
1 | 0137
2 | 47
3 |
4 |
5 | 2
The value for scale will at times require experimentation, with the end goal of having the "stems" step by one.
No comments:
Post a Comment