powered by
Plot of survival, hazard and hazard ratio of two groups as a function of time using ggplot and patchwork
shhr_gg( A, B, main = NULL, sub = NULL, group_names = c("control", "treatment"), lab_time = "Days", lab_group = "Group", trafo_time = identity, colours = palette()[c(1, 3)], linetypes = c(1, 3), linewidths = c(1.3, 1.3), as_list = FALSE )
a patchwork object as defined in the patchwork package or a list of ggplot objects if as_list=TRUE.
patchwork
as_list=TRUE
mixpch object for group 1 (reference)
mixpch object for group 2
Title for the overall plot
Subtitle for the overall plot
Group Names
Title for the time axis
Title group legend
Function to transform time
vector of two colours
vector of two linetypes
vector of two linewidths
return a list of ggplot objects instead of a patchwork object
# \donttest{ library(ggplot2) library(patchwork) library(nph) B <- pchaz(c(0, 10, 100), c(0.1, 0.05)) A <- pchaz(c(0, 100), c(0.1)) shhr_gg(A, B) shhr_gg(A, B, lab_time="Months", trafo_time=d2m) # }
Run the code above in your browser using DataLab