Description Usage Arguments Aesthetics Examples
View source: R/geom-errorbarh.r
A rotated version of geom_errorbar()
.
1 2 3 |
mapping |
Set of aesthetic mappings created by |
data |
The data to be displayed in this layer. There are three options: If A A |
stat |
The statistical transformation to use on the data for this layer, as a string. |
position |
Position adjustment, either as a string, or the result of a call to a position adjustment function. |
... |
Other arguments passed on to |
na.rm |
If |
show.legend |
logical. Should this layer be included in the legends?
|
inherit.aes |
If |
geom_errorbarh()
understands the following aesthetics (required aesthetics are in bold):
xmin
xmax
y
alpha
colour
group
height
linetype
size
Learn more about setting these aesthetics in vignette("ggplot2-specs")
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | 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, colour = group))
p + geom_point() +
geom_errorbarh(aes(xmax = resp + se, xmin = resp - se))
p + geom_point() +
geom_errorbarh(aes(xmax = resp + se, xmin = resp - se, height = .2))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.