geom_hspan | R Documentation |
xmin
, xmax
ymin
, ymax
: optional
geom_hspan(
mapping = NULL,
data = NULL,
stat = "hspan",
position = "identity",
...,
ymin = -Inf,
ymax = Inf,
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 |
library(ggplot2)
library(data.table)
d = data.table(x = 1:10, y = 1:10)
d_span = data.table(xmin = c(1, 4), xmax = c(3, 5), group = 1:2)
ggplot(d, aes(x, y)) +
geom_point() +
geom_hspan(data = d_span, aes(x = NULL, y = NULL, xmin = xmin, xmax = xmax, group = group),
alpha = 0.2, fill = "yellow")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.