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.

 "mapping" = null,
 "data" = null,
 "position" = "identity",
 "binwidth" = null,
 "binaxis" = "x",
 "method" = "dotdensity",
 "binpositions" = "bygroup",
 "stackdir" = "up",
 "stackratio" = 1,
 "dotsize" = 1,
 "stackgroups" = false,
 "origin" = null,
 "right" = true,
 "width" = 0.9,
 "drop" = false,
 "na.rm" = false,
 "show.legend" = NA,
 "inherit.aes" = true



Set of aesthetic mappings created by aes() or aes_(). If specified and inherit.aes = TRUE (the default), it is combined with the default mapping at the top level of the plot. You must supply mapping if there is no plot mapping.


The data to be displayed in this layer. There are three options:

If NULL, the default, the data is inherited from the plot data as specified in the call to cxplot().

A data.frame, or other object, will override the plot data. All objects will be fortified to produce a data frame. See fortify() for which variables will be created.

A function will be called with a single argument, the plot data. The return value must be a data.frame, and will be used as the layer data. A function can be created from a formula (e.g. ~ head(.x, 10)).


Position adjustment, either as a string, or the result of a call to a position adjustment function.


Other arguments passed on to layer(). These are often aesthetics, used to set an aesthetic to a fixed value, like color = "red" or size = 3. They may also be parameters to the paired geom/stat.


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


The axis to bin along, "x" (default) or "y"


"dotdensity" (default) for dot-density binning, or "histodot" for fixed bin widths (like stat_bin)


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 groups.


which direction to stack the dots. "up" (default), "down", "center", "centerwhole" (centered, but with dots aligned)


how close to stack the dots. Default is 1, where dots just touch. Use smaller values for closer, overlapping dots.


The diameter of the dots relative to binwidth, default 1.


should dots be stacked across groups? This has the effect that position = "stack" should have, but can't (because this geom has some odd properties).


When method is "histodot", origin of first bin


When method is "histodot", should intervals be closed on the right (a, b], or not [a, b)


When binaxis is "y", the spacing of the dot stacks for dodging.


If TRUE, remove all bins with zero counts


If FALSE, the default, missing values are removed with a warning. If TRUE, missing values are silently removed.


logical. Should this layer be included in the legends? NA, the default, includes if any aesthetics are mapped. FALSE never includes, and TRUE always includes. It can also be a named logical vector to finely select the aesthetics to display.


If FALSE, overrides the default aesthetics, rather than combining with them. This is most useful for helper functions that define both data and aesthetics and shouldn't inherit behaviour from the default plot specification, e.g. borders().


There are two basic approaches: dot-density and histodot. With dot-density 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 dot-density 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 cxplot. You can hide the y axis, as in one of the examples, or manually scale it to match the number of dots.


geom_dotplot() understands the following aesthetics (required aesthetics are in bold):









Learn more about setting these aesthetics in vignette("cxplot-specs").

Computed variables


center of each bin, if binaxis is "x"


number of points in bin


density of points in bin, scaled to integrate to 1, if method is "histodot"



Wilkinson, L. (1999) Dot plots. The American Statistician, 53(3), 276-281.


var cxp = new cxplot("canvas1", mtcars, aes({"x" : "mpg"}));
var cxp = new cxplot("canvas2", mtcars, aes({"x" : "mpg"})); cxp.geom_dotplot({"binwidth" : 1.5});
// Some other stacking methods var cxp = new cxplot("canvas3", mtcars, aes({"x" : "mpg"})); cxp.geom_dotplot({"binwidth" : 1.5, "stackdir" : "center"});
var cxp = new cxplot("canvas4", mtcars, aes({"x" : "mpg"})); cxp.geom_dotplot({"binwidth" : 1.5, "stackdir" : "centerwhole"});
// Overlap dots vertically var cxp = new cxplot("canvas5", mtcars, aes({"x" : "mpg"})); cxp.geom_dotplot({"binwidth" : 1.5, "stackratio" : 0.7});
// Change dot fill colour, stroke width var cxp = new cxplot("canvas6", mtcars, aes({"x" : "mpg"})); cxp.geom_dotplot({"binwidth" : 1.5, "fill" : "white", "stroke" : 2});
// Examples with stacking along y axis instead of x var cxp = new cxplot("canvas7", mtcars, aes({"x": {"factor": "cyl"}, "y" : "mpg"})); cxp.geom_dotplot({"binaxis" : "y", "stackdir" : "center"});
var cxp = new cxplot("canvas8", mtcars, aes({"x": {"factor": "cyl"}, "y" : "mpg"})); cxp.geom_dotplot({"binaxis" : "y", "stackdir" : "centerwhole"});
var cxp = new cxplot("canvas9", mtcars, aes({"x": {"factor": "vs"}, "fill": {"factor": "cyl"}, "y" : "mpg"})); cxp.geom_dotplot({"binaxis" : "y", "stackdir" : "center", "position": "dodge"});
var cxp = new cxplot("canvas10", mtcars, aes({"x": {"factor": "am"}, "y" : "mpg"})); cxp.geom_dotplot({"binaxis" : "y", "stackdir" : "center"});
// Stacking multiple groups, with different fill var cxp = new cxplot("canvas11", mtcars, aes({"x" : "mpg", "fill": {"factor": "cyl"}})); cxp.geom_dotplot({"binwidth" : 1});