Open erbw opened 2 years ago
You can use the codes below to transfer a ggsurvplot to a ggplot subject:
p <- ggsurvplot(fit,data=surv_data)
p1 <- p$plot
p1 <- p1 + annotate("text", label = "DRAFT", x = 0, y = 0, hjust = 1, vjust = 1)
Once transfered, it can be treated as a regular ggplot.
Expected behavior
Produce plot with annotation
Actual behavior
Error in ggsurvplot(fit, data = surv_data) + annotate("text", label = "DRAFT", : non-numeric argument to binary operator In addition: Warning message: Incompatible methods ("+.ggsurv", "+.gg") for "+"
Workaround: replace + with %++% produces desired plot
Steps to reproduce the problem
ggsurvplot(fit,data=surv_data) + annotate("text", label = "DRAFT", x = 0, y = 0, hjust = 1, vjust = 1)
session_info()