kassambara / survminer

Survival Analysis and Visualization
https://rpkgs.datanovia.com/survminer/
509 stars 164 forks source link

Change ylim in plot hides pvalue from ggsurvplot #290

Open tvedebrink opened 6 years ago

tvedebrink commented 6 years ago

When changing the ylim to say ylim = c(0.6, 1) hides the pvalue from the output (if pval = TRUE). And it is not immediately clear how to add to a ggsurvplot with call

death_treat <- survfit(Surv(days_to_event, status) ~ treatment, data = data_death)
ggsurvplot(death_treat, data = data_death, 
           conf.int = TRUE,
           pval = TRUE, 
           xlim = c(0, outcome*365),
           ## ylim = c(0.6, 1),
           break.time.by = 30*3,
           ggtheme = theme_bw(), 
           risk.table.y.text = FALSE,
           risk.table = TRUE)
TomJHBennett commented 5 years ago

Try adding pval.coord =c(1, 1) to your argument. Sort of shoves the p-value top left of your graph. I'm new to GitHub and R so may not have made this comment properly in terms of either.