View source: R/geom-errorbarh.R
geom_errorbarh | R Documentation |
A rotated version of geom_errorbar()
.
geom_errorbarh(
mapping = NULL,
data = NULL,
stat = "identity",
position = "identity",
...,
na.rm = FALSE,
show.legend = NA,
inherit.aes = TRUE
)
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.
When using a
|
position |
A position adjustment to use on the data for this layer. This
can be used in various ways, including to prevent overplotting and
improving the display. The
|
... |
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
linewidth
Learn more about setting these aesthetics in vignette("ggplot2-specs")
.
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.