pharmaverse / ggsurvfit

http://www.danieldsjoberg.com/ggsurvfit/
Other
67 stars 19 forks source link

Censor marks made with geom_linerange as an extra option to geom_point #168

Closed psoldath closed 9 months ago

psoldath commented 9 months ago

Is your feature request related to a problem? Please describe. Censor marks are easily added with the add_censor_mark() call that has all the arguments of ggplot2::geom_point(). This works very well and is undoubtedly the most common way to make censor marks, however, I think it has an aesthetic drawback as the size and line width of the different points don't match the size and line width of the survival curves. If you e.g. use the | as censor mark and you don't want it to be too long compared to your curve you have to set it to a smaller size, but then you may think it gets too narrow compared to the line width of the survival curve.

Describe the solution you'd like I think a nice option could be if the censor marks could also be set with the ggplot2::geom_linerange as an extra option to geom_point. The geom_linerange option would be able to make censor marks with a line with an exact specification of the line width so it can be matched with the line width of the survival curve in any proportional size. The range of the geom_linerange could be specified as an either the exact range above and below the survival curve (e.g. ymin = surv - 0.01, ymax = surv + 0.01) or as a size relative to the line width?

ddsjoberg commented 9 months ago

I see your point, but I don't think I'll be implementing and maintaining this feature, as I think it will be infrequently used and be finicky to maintain. I suggest that you copy the ggsurvfit::add_censor_mark() function into your own package and make the modifications for your purposes. Happy Programming!