add_ggsurvplot: Add Components to a ggsurvplot

Description Usage Arguments See Also Examples

Description

Allows to add ggplot components - theme(), labs(), ... - to an object of class ggsurv, which is a list of ggplots.

Usage

1
2
3
4
## S3 method for class 'ggsurv'
e1 + e2

e1 %++% e2

Arguments

e1

an object of class ggsurv.

e2

a plot component such as theme and labs.

See Also

theme_survminer and ggsurvplot

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
# Fit survival curves
require("survival")
fit<- survfit(Surv(time, status) ~ sex, data = lung)

# Basic survival curves
p <- ggsurvplot(fit, data = lung, risk.table = TRUE,
   main = "Survival curve",
   submain = "Based on Kaplan-Meier estimates",
   caption = "created with survminer"
   )
p

# Customizing the plots
p + theme_survminer(
     font.main = c(16, "bold", "darkblue"),
     font.submain = c(15, "bold.italic", "purple"),
     font.caption = c(14, "plain", "orange"),
     font.x = c(14, "bold.italic", "red"),
     font.y = c(14, "bold.italic", "darkred"),
     font.tickslab = c(12, "plain", "darkgreen")
)

Example output

Loading required package: ggplot2
Loading required package: ggpubr
Loading required package: magrittr
Loading required package: survival

survminer documentation built on March 9, 2021, 5:07 p.m.