View source: R/ggplot_functions.R
| stat_errorbar | R Documentation |
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.
stat_errorbar(...) geom_errorbars(...)
... |
Additional arguments for the |
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.
A list of the stat_summary objects
stat_dots_and_bar
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")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.