Closed ddsjoberg closed 8 months ago
I am not so sure about this feature.
🤔
library(ggsurvfit)
#> Loading required package: ggplot2
df <-
survfit2(Surv(time, status) ~ 1, data = df_lung) %>%
tidy_survfit()
df |>
ggplot() +
geom_ribbon(aes(x = time, ymin = 0, ymax = cum.event), fill = "lightslateblue") +
geom_ribbon(aes(x = time, ymin = n.risk[1], ymax = n.risk[1] - cum.censor), fill = "lightblue") +
theme_void()
Created on 2023-09-30 with reprex v2.0.2
maybe we just export a function that takes two arguments: the first would be the primary plot from a ggsurvfit object, and the second is a plot we wish to align with the first?
I'll need to review how the alignments are made, but I think this could work... then we could more easily let users customize plots however they like.
we now export utility functions that make this possible, and there is an example here in the documentation https://www.danieldsjoberg.com/ggsurvfit/dev/reference/ggsurvfit_align_plots.html
Include figure representations of the risktable. For example, a little bar chart indicating where censor or event occurs (not cumulative).
I would prefer a cumulative figure in the risktable section. We could have variants that show the cumulative events or censoring where the line (or area line) begins are zero and terminates in the upper right corner with the total number events or censored obs.
Another variant would be where the upper boundary of the plot is the total N. Maybe events could crawl up, and number of censored obs could crawl down from the upper left corner, illustrating the cumulative counts for each separately.