Download Unix User Guide

Transcript
CHAPTER 7 TRADITIONAL TRELLIS GRAPHICS
dotplot
The dot plot, which displays data with labels, provides highly accurate visual
decodings, typically far more accurate than other methods for displaying
labeled data. Let us compute the mean mileage for each vehicle type:
> mileage.means <- tapply(fuel.frame$Mileage,
+
fuel.frame$Type, mean)
Figure 7.10 is a dot plot of the log base 2 means:
> dotplot(names(mileage.means)~logb(mileage.means,
+
base=2),aspect=1,cex=1.25)
The argument cex is passed to the panel function to change the size of the
dot of the dot plot; more on this in the section Panel Functions (page 246).
Notice that the vehicle types in figure 7.10 are ordered, from bottom to top,
by the order of the elements of the vector mileage.means. If you wanted the
graph to show the values from smallest to largest going from bottom to top,
you could first redefine mileage.means:
> mileage.means <- sort(mileage.means)
Van
Sporty
Small
Medium
Large
Compact
4.4
4.6
log(mileage.means, base = 2)
Figure 7.10: Dot plot.
216
4.8