Graphics Reference
In-Depth Information
Figure 6-27. Dot plot with no y labels, max bin size of .25, and a rug showing each data point
You may notice that the stacks aren't regularly spaced in the horizontal direction. With the de-
fault
dotdensity
binning algorithm, the position of each stack is centered above the set of data
points that it represents. To use bins that are arranged with a fixed, regular spacing, like a his-
above the data:
p
+
geom_dotplot(method
=
"histodot"
, binwidth
=
.25
)
+
geom_rug()
+
scale_y_continuous(breaks
=
NULL
NULL
)
+
theme(axis.title.y
=
element_blank())
Figure 6-28. Dot plot with histodot (fixed-width) binning
The dots can also be stacked centered, or centered in such a way that stacks with even and
odd quantities stay aligned. This can by done by setting
stackdir="center"
or
stack-
dir="centerwhole"
, as illustrated in
Figure 6-29
: