View source: R/geom_half_dotplot.R
geom_half_dotplot  R Documentation 
In a dot plot, the width of a dot corresponds to the bin width (or maximum width, depending on the binning algorithm), and dots are stacked, with each dot representing one observation.
geom_half_dotplot( mapping = NULL, data = NULL, position = "dodge", ..., binwidth = NULL, binaxis = "y", method = "dotdensity", binpositions = "bygroup", stackdir = "up", stackratio = 1, dotsize = 1, stackgroups = FALSE, origin = NULL, right = TRUE, width = NULL, drop = FALSE, na.rm = FALSE, show.legend = NA, inherit.aes = TRUE )
mapping 
Set of aesthetic mappings created by 
data 
The data to be displayed in this layer. There are three options: If A A 
position 
Position adjustment, either as a string, or the result of a call to a position adjustment function. 
... 
Other arguments passed on to 
binwidth 
When 
binaxis 
The axis to bin along, "x" (default) or "y" 
method 
"dotdensity" (default) for dotdensity binning, or "histodot" for fixed bin widths (like stat_bin) 
binpositions 
When 
stackdir 
Which direction to stack the dots. "up" (default) places the halfdotplot on the right side. "down" on the left side. 
stackratio 
how close to stack the dots. Default is 1, where dots just touch. Use smaller values for closer, overlapping dots. 
dotsize 
The diameter of the dots relative to 
stackgroups 
should dots be stacked across groups? This has the effect
that 
origin 
When 
right 
When 
width 
When 
drop 
If TRUE, remove all bins with zero counts 
na.rm 
If 
show.legend 
logical. Should this layer be included in the legends?

inherit.aes 
If 
There are two basic approaches: dotdensity and histodot. With dotdensity binning, the bin positions are determined by the data and 'binwidth', which is the maximum width of each bin. See Wilkinson (1999) for details on the dotdensity binning algorithm. With histodot binning, the bins have fixed positions and fixed widths, much like a histogram.
When binning along the x axis and stacking along the y axis, the numbers on y axis are not meaningful, due to technical limitations of ggplot2. You can hide the y axis, as in one of the examples, or manually scale it to match the number of dots.
center of each bin, if binaxis is "x"
center of each bin, if binaxis is "x"
max width of each bin if method is "dotdensity"; width of each bin if method is "histodot"
number of points in bin
count, scaled to maximum of 1
density of points in bin, scaled to integrate to 1, if method is "histodot"
density, scaled to maximum of 1, if method is "histodot"
Wilkinson, L. (1999) Dot plots. The American Statistician, 53(3), 276281.
ggplot(iris, aes(x = Species, y = Petal.Width, fill = Species)) + geom_half_dotplot(stackratio = .5, method = "histodot")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.