stat_dots_and_bar: Make dotplots with error bars with a single function

View source: R/ggplot_functions.R

stat_dots_and_barR Documentation

Make dotplots with error bars with a single function

Description

Adds a dotplot, 95\ to a ggplot object. Almost identical to stat_errorbar, but with the obvious additional geom_dotplot.

Right now, only uses default values for the error bars.

Usage

stat_dots_and_bar(
  ...,
  binaxis = "y",
  stackdir = "center",
  dotsize = 0.5,
  alpha = 0.2
)

geom_dots_and_bars(
  ...,
  binaxis = "y",
  stackdir = "center",
  dotsize = 0.5,
  alpha = 0.2
)

Arguments

...

Additional arguments for the stat_summary pair.

binaxis

Set by default to "y"

stackdir

Set by default to "center"

dotsize

Set by default to 0.5

alpha

Set by default to 0.2

Details

geom_dots_and_bars is the deprecated name for stat_dots_and_bar. I realized that ggplot2 already had a geom_errorbar, which would be very confusing for geom_dots_and_bars's sister function, geom_errorbars. To keep the naming similarity, and because geom_dots_and_bars operated more like a stat function (e.g., stat_summary) than a geom, it made more sense to change its name.

Value

A list of the stat_summary objects

See Also

stat_errorbar

Examples

df <- data.frame(
  y<-rnorm(100),
  x<-factor(c(rep("Label1",50), rep("Label2",50)))
)

ggplot(df, aes(x = x, y = y)) +
  stat_dots_and_bar(color="red",fill="red") +
  xlab("WHAAAT")

burchill/zplyr documentation built on Feb. 2, 2023, 11:01 a.m.