View source: R/geom_stepribbon.R
geom_stepribbon | R Documentation |
geom_stepribbon
is an extension of the geom_ribbon
, and
is optimized for Kaplan-Meier plots with pointwise confidence intervals
or a confidence band. The default direction
-argument "hv"
is
appropriate for right-continuous step functions like the hazard rates etc
returned by pammtools
.
geom_stepribbon(
mapping = NULL,
data = NULL,
stat = "identity",
position = "identity",
direction = "hv",
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
|
direction |
direction of stairs: 'vh' for vertical then horizontal, 'hv' for horizontal then vertical, or 'mid' for step half-way between adjacent x-values. |
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
.
library(ggplot2)
huron <- data.frame(year = 1875:1972, level = as.vector(LakeHuron))
h <- ggplot(huron, aes(year))
h + geom_stepribbon(
aes(
ymin = level - 1,
ymax = level + 1
),
fill = "grey70"
) +
geom_step(aes(y = level))
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.