I'm trying to label the lines on the output of an autoplot generated from a survfit object. I've been experimenting with the directlabels
package without success (the issue seems to be that the geom_* functions don't have access to the underlying data and cannot find the variables from the dataset when used in conjunction with a survfit object, rather than just the data itself inside a ggplot.
The autoplot routine I'm using now is:
autoplot(survfit(Surv(time, status) ~ sex, data = lung), fun = 'event')
This generates a plot like:
What I would like to do is to relocate the legend "strata" from the right side onto the lines (right above them on the left, or right, those details aren't important to me).
I do not wish to label each individual point, just to label each line locally.