View source: R/stat_stepribbon.R
stat_stepribbon | R Documentation |
Provides stair-step values for ribbon plots, often using in
conjunction with ggplot2::geom_step()
.
The step ribbon can be added with stat_stepribbon()
or
identically with ggplot2::geom_ribbon(stat = "stepribbon")
stat_stepribbon(
mapping = NULL,
data = NULL,
geom = "ribbon",
position = "identity",
na.rm = FALSE,
show.legend = NA,
inherit.aes = TRUE,
direction = "hv",
...
)
StatStepribbon
mapping |
Set of aesthetic mappings created by |
data |
The data to be displayed in this layer. There are three options: If A A |
geom |
which geom to use; defaults to " |
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 |
direction |
|
... |
Other arguments passed on to |
An object of class StatStepRibbon
(inherits from Stat
, ggproto
, gg
) of length 3.
a ggplot
https://groups.google.com/forum/?fromgroups=#!topic/ggplot2/9cFWHaH1CPs
# using ggplot2::geom_ribbon()
survival::survfit(survival::Surv(time, status) ~ 1, data = survival::lung) %>%
survival::survfit0() %>%
broom::tidy() %>%
ggplot2::ggplot(ggplot2::aes(x = time, y = estimate, ymin = conf.low, ymax = conf.high)) +
ggplot2::geom_step() +
ggplot2::geom_ribbon(stat = "stepribbon", alpha = 0.2)
# using stat_stepribbon() with the same result
survival::survfit(survival::Surv(time, status) ~ 1, data = survival::lung) %>%
survival::survfit0() %>%
broom::tidy() %>%
ggplot2::ggplot(ggplot2::aes(x = time, y = estimate, ymin = conf.low, ymax = conf.high)) +
ggplot2::geom_step() +
visR::stat_stepribbon(alpha = 0.2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.