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

ggsurvfit should use the mitre linejoin for geom_step #207

Open
psoldath opened this issue Apr 28, 2024 · 2 comments
Open

ggsurvfit should use the mitre linejoin for geom_step #207

psoldath opened this issue Apr 28, 2024 · 2 comments

Comments

@psoldath
Copy link

Hi Daniel

I know you are working on releasing a new version of ggsurvfit to accommodate the recent changes in the survival package and ggplot2. In this regard, I think it would be beneficial to also update the defaults of the ggsurvfit() and ggcuminc() geoms to use the newly implemented "mitre" linejoin for geom_step() instead of the "round" linejoin. The mitre linejoin would allow for more accurate digitisation of the plot data and reconstruction of the event times as described in these GitHubs:
tidyverse/ggplot2#5705
tidyverse/ggplot2#5706

@ddsjoberg
Copy link
Collaborator

Hi @psoldath , I hadn't read about that update yet. Thanks for letting me know. Can you show a side-by-side comparison of the difference in the appearance of the rendered plot? This will also require updates to the exported step ribbon method as well to match.

@psoldath
Copy link
Author

psoldath commented Apr 29, 2024

Of course, @ddsjoberg
It does not require you to update the geom_ribbon as it already uses sharp corners at steps.
As you can see the mitre linejoin allows for digitization software to find the exact time of events as the midpoint of the diagonal line of each step, whereas the round linejoin curves one of the corners and hereby shortens the diagonal distance, so the midpoint of the diagonal line doesn't reflect the exact time of event.

library(tidyverse)
library(ggsurvfit)

#Round linejoin
round <- survfit2(Surv(time, status) ~ surg, data = df_colon) %>%
ggsurvfit()

#Mitre linejoin
mitre <- survfit2(Surv(time, status) ~ surg, data = df_colon) %>%
ggsurvfit(linejoin = "mitre")

Round linejoin:

round

Mitre linejoin:
mitre

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