Learn R Programming

ggplot2 (version 0.9.0)

stat_bindot: Bin data for dot plot.

Description

Missing values are currently silently dropped. If weights are used, they must be integer values.

Usage

stat_bindot(mapping = NULL, data = NULL,
    geom = "dotplot", position = "identity",
    binwidth = NULL, origin = NULL, width = 0.9,
    binaxis = "x", method = "dotdensity",
    binpositions = "bygroup", drop = FALSE, right = TRUE,
    na.rm = FALSE, ...)

Arguments

binaxis
The axis to bin along, "x" (default) or "y"
method
"dotdensity" (default) for dot-density binning, or "histodot" for fixed bin widths (like stat_bin)
binwidth
When method is "dotdensity, this specifies maximum bin width. When method is "histodot", this specifies bin width. Defaults to 1/30 of the range of the data
binpositions
When method is "dotdensity", "bygroup" (default) determines positions of the bins for each group separately. "all" determines positions of the bins with all the data taken together; this is used for aligning dot stacks across multiple
origin
When method is "histodot", origin of first bin
right
When method is "histodot", should intervals be closed on the right (a, b], or not [a, b)
width
When binaxis is "y", the spacing of the dot stacks for dodging.
na.rm
If FALSE (the default), removes missing values with a warning. If TRUE silently removes missing values.
drop
If TRUE, remove all bins with zero counts
mapping
The aesthetic mapping, usually constructed with aes or aes_string. Only needs to be set at the layer level if you are overriding the plot defaults.
data
A layer specific dataset - only needed if you want to override the plot defaults.
geom
The geometric object to use display the data
position
The position adjustment to use for overlappling points on this layer
...
other arguments passed on to layer. This can include aesthetics whose values you want to set, not map. See layer for more details.

Value

  • New data frame with additional columns:
  • xcenter of each bin, if binaxis is "x"
  • ycenter of each bin, if binaxis is "x"
  • binwidthmax width of each bin if method is "dotdensity"; width of each bin if method is "histodot"
  • countnumber of points in bin
  • ncountcount, scaled to maximum of 1
  • densitydensity of points in bin, scaled to integrate to 1, if method is "histodot"
  • ndensitydensity, scaled to maximum of 1, if method is "histodot"

Examples

Run this code
# See geom_dotplot for examples

Run the code above in your browser using DataLab