kassambara / survminer

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

misalignment between the chart and the risk table in ggsurvplot #649

Open Monique84 opened 6 months ago

Monique84 commented 6 months ago

I am observing an ugly misalignment between the chart and the risk table plotting with ggsurvplot of survminer package in R version 4.3.3 (2024-02-29 ucrt) -- "Angel Food Cake" (

https://i.stack.imgur.com/4YkaM.pngenter image description here)

I would like to display (as the code has always done until a couple of days ago) survival chart and risk table perfectly aligned so that the year notches in the two axes coincide.

fernandocatto commented 6 months ago

Hi,

I have the same problem! Two months ago I used the same code and the graphic and risk table were aligned. Have you figured the problem out?

Monique84 commented 6 months ago

No. Waiting for the problem to be fixed I am using another package for survival curves.

hemy2511 commented 6 months ago

I have the same issue, a temporary solution is to use an older version of ggplot2 (version 3.4.3) as it seems to be the ggplot2 update which has caused the issue. remotes::install_version(package = "ggplot2", version = "3.4.3")

wbvguo commented 4 months ago

I saw the same issue with ggplot2 3.5.0, rollbacking to ggplot2 3.4.3 temporarily solved the problem.

Any plan to fix this issue to accommodate 3.5.0 ?

harriscw commented 4 months ago

Same issue here, code previously working correctly now showed misalignment between plot and at risk table. Super helpful discussion and suggestion to roll back ggplot2

lwfy123 commented 3 months ago

Yes. Adding "tables.y.text = FALSE" to the ggsurvplot function can solve the above problem.

rfbrondum commented 1 month ago

Similar issue here using ggplot2 v3.5.1 with survminer 0.4.9.

Another potential workaround is to use the patchwork package for collecting the plot and risk table, e.g.:

p$plot / p$table + plot_layout(heights = c(8,2))