View source: R/geom_km_ticks.R
geom_km_ticks | R Documentation |
Adds tickmarks at the times when there are censored observations but no
events.
geom_km_ticks(
mapping = NULL,
data = NULL,
stat = "km_ticks",
position = "identity",
show.legend = NA,
inherit.aes = TRUE,
na.rm = 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
|
show.legend |
logical. Should this layer be included in the legends?
|
inherit.aes |
If |
na.rm |
If |
... |
Other arguments passed on to
|
geom_km_ticks()
understands the following aesthetics (required aesthetics in bold):
x
: the survival/censoring times, automatically mapped by stat_km_ticks()
.
y
: the survival probability estimates, automatically mapped by stat_km_ticks()
.
alpha
color
shape
size
stroke
fill
Michael Sachs (in ggkm
), Samer Mouksassi (in ggquickeda
).
The default stat
for this geom
is stat_km_ticks()
.
library(ggplot2)
sex <- rbinom(250, 1, .5)
df <- data.frame(
time = exp(rnorm(250, mean = sex)),
status = rbinom(250, 1, .75),
sex = sex
)
ggplot(df, aes(time = time, status = status, color = factor(sex), group = factor(sex))) +
geom_km() +
geom_km_ticks(col = "black")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.