Graphics Reference
In-Depth Information
p + geom_dotplot(binwidth = .25 , stackdir = "center" )
scale_y_continuous(breaks = NULL
NULL ) + theme(axis.title.y = element_blank())
p + geom_dotplot(binwidth = .25 , stackdir = "centerwhole" )
scale_y_continuous(breaks = NULL
NULL ) + theme(axis.title.y = element_blank())
Figure 6-29. Left: dot plot with stackdir="center"; right: with stackdir="centerwhole"
See Also
Leland Wilkinson, “Dot Plots,” The American Statistician 53 (1999): 276-281, ht-
tp://www.cs.uic.edu/~wilkinson/Publications/dots.pdf .
Making Multiple Dot Plots for Grouped Data
Problem
You want to make multiple dot plots from grouped data.
Solution
To compare multiple groups, it's possible to stack the dots along the y-axis, and group them
along the x-axis, by setting binaxis="y" . For this example, we'll use the heightweight data
set ( Figure 6-30 ) :
library(gcookbook) # For the data set
ggplot(heightweight, aes(x = sex, y = heightIn)) +
geom_dotplot(binaxis = "y" , binwidth = .5 , stackdir = "center" )
Search WWH ::




Custom Search