stat_errorbar: Make ggplot error bars and mean with a single function

View source: R/ggplot_functions.R

stat_errorbarR Documentation

Make ggplot error bars and mean with a single function

Description

Often, automatically bootstrapped error bars in ggplot2 are accompanied by a dot indicating the mean of the errorbars. Generally, this is done with two calls of stat_summary, one for the bars and one for the dot. This function is just a shortcut that will add both.

Usage

stat_errorbar(...)

geom_errorbars(...)

Arguments

...

Additional arguments for the stat_summary pair.

Details

geom_errorbars is the deprecated name for stat_errorbar. I realized that ggplot2 already had a geom_errorbar, which would be very confusing. Additionally, since geom_errorbars operated more like a stat function (e.g., stat_summary), it made more sense to change its name.

Value

A list of the stat_summary objects

See Also

stat_dots_and_bar

Examples

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

ggplot(df, aes(x = x, y = y)) +
  geom_point(alpha=0.3) +
  stat_errorbar(color="red") +
  xlab("WHAAAT")

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