geom_errorbarh {ggplot2} | R Documentation |
Horizontal error bars
geom_errorbarh(mapping=NULL, data=NULL, stat="identity", position="identity", ...)
mapping |
mapping between variables and aesthetics generated by aes |
data |
dataset used in this layer, if not specified uses plot dataset |
stat |
statistic used by this layer |
position |
position adjustment used by this layer |
... |
ignored |
This page describes geom_errorbarh, see layer
and qplot
for how to create a complete plot from individual components.
A layer
The following aesthetics can be used with geom_errorbarh. Aesthetics are mapped to variables in the data with the aes function: geom\_errorbarh(aes(x = var))
x
: x position (required)
xmin
: left (hortizontal minimum) (required)
xmax
: right (hortizontal maximum) (required)
colour
: border colour
size
: size
linetype
: line type
width
: width
alpha
: transparency
Hadley Wickham, http://had.co.nz/
geom_errorbar
: vertical error bars
## Not run: df <- data.frame( trt = factor(c(1, 1, 2, 2)), resp = c(1, 5, 3, 4), group = factor(c(1, 2, 1, 2)), se = c(0.1, 0.3, 0.3, 0.2) ) # Define the top and bottom of the errorbars p <- ggplot(df, aes(resp, trt, fill = group)) p + geom_point() + geom_errorbarh(aes(xmax = resp + se, xmin = resp - se)) last_plot() + aes(colour = group) ## End(Not run)