Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Add feature to plot a curve for pooled data (similar to Survminer::ggsurvplot_add_all) #219

Open
drhmoosavi opened this issue Jul 5, 2024 · 1 comment

Comments

@drhmoosavi
Copy link

Is your feature request related to a problem? Please describe.
Currently it seems not possible to add a curve for pooled patient data to the plot.

for example in the example below, it is not possible to create a third curve from combined patient data, in addition to the other 2 curves.

fA <- survfit2(Surv(time, status) ~ sex + adhere, data = df_colon %>% filter(sex == "Female") ) 
fA %>% 
  ggsurvfit(linewidth = 1,linetype_aes = FALSE) +
  add_quantile(y_value = 0.5, color = "black", linewidth = 0.5, linetype= "D3") +
  scale_color_manual(NULL, values = c("red3","#0F8A2F","#30196F")) +
  scale_x_continuous('Time (months)', breaks = seq(0, 9, 3)) +
  labs(x = "Months", y = "OS")  +
  theme_cowplot()
@ddsjoberg
Copy link
Collaborator

Hi @drhmoosavi ,

You can add more plots to the same figure by stacking the dataset before passing to survfit(). Example here: #212

But let's keep this open, and when we get to a point when ggsurvfit comes to the top of the list for development, we can think of some solutions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants