geom_stepribbon | R Documentation |
geom_stepribbon
is an extension of the geom_ribbon
, and
is optimized for survival function plots with pointwise confidence intervals
or differences between survival curves, such as for
estimate_rmtl
.
geom_stepribbon(
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, either as a |
position |
Position adjustment, either as a string naming the adjustment
(e.g. |
na.rm |
If |
show.legend |
logical. Should this layer be included in the legends?
|
inherit.aes |
If |
... |
Other arguments passed on to |
geom_ribbon
geom_stepribbon
inherits from geom_ribbon
.
Original code: https://github.com/cran/RcmdrPlugin.KMggplot2/blob/master/R/geom-stepribbon.r
Modified code (used here): https://github.com/adibender/ldatools/blob/master/R/geom_stepribbon.R
library(ggplot2)
huron <- data.frame(year = 1875:1972, level = as.vector(LakeHuron))
h <- ggplot(huron, aes(year))
# Step ribbon
h + geom_stepribbon(aes(ymin = level - 1, ymax = level + 1), fill = "grey70") +
geom_step(aes(y = level))
# For comparison, simple ribbon
h + geom_ribbon(aes(ymin = level - 1, ymax = level + 1), fill = "grey70") +
geom_line(aes(y = level))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.