ggprodlim | R Documentation |
ggplot2::ggplot support for Kaplan-Meier and Aalen-Johansen estimators
ggprodlim(x, x_at, pos_atrisk, ...)
x |
object obtained with |
x_at |
Vector containg the positions for ticks on the x-axis |
pos_atrisk |
Vector with x positions for numbers at risk |
... |
passed on to |
Important functionality like facet_grid is not yet supported
A ggplot2::ggplot object
Thomas A. Gerds <tag@biostat.ku.dk>
plot.prodlim
library(ggplot2)
d <- SimCompRisk(117)
fit1 <- prodlim(Hist(time,event)~1,data = d)
ggprodlim(fit1,x_at = c(0,4,8,12))
g <- ggprodlim(fit1,x_at = c(0,4,8,12))+ggthemes::theme_solarized()
g+theme(plot.margin = margin(t = 0,r = 0,b = 4,l = 0,"line"))
g <- g+ggplot2::scale_fill_manual(values = grDevices::palette.colors(palette = "Okabe-Ito"))
g <- g+ggplot2::scale_color_manual(values = grDevices::palette.colors(palette = "Okabe-Ito"))
d$X1 <- factor(d$X1,levels=c("1","0"),labels=c("1","0"))
fit <- prodlim(Hist(time,event)~X1,data = d)
ggprodlim(fit,cause = 1,x_at = c(0,6,12))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.