I am making a survival curve using R in R studio. I am trying to rotate the title of my y axis to be horizontal, using guidance from previous posts, and I keep receiving an error message. I am using the following code:
my_survplot_c = ggsurvplot(my_survfit_c, data = cohort_comb,
risk.table = TRUE,
ggtheme = theme_bw(),
palette = "Dark2",
conf.int = FALSE,
pval=FALSE,
legend.title = "OTC Offered", legend.labs = c("No", "Yes"),
ylab = "Proportion without POI", xlab = "Time (years)")
my_survplot_c + ylab("Proportion\nwithout POI") + theme(axis.title.y = element_text(angle=0))
my_survplot_c
The error message I am receiving is: Error in my_survplot_c + ylab("Number of\nSolutions") + theme(axis.title.y = element_text(angle = 0)) : non-numeric argument to binary operator
I suspect the solution is simple but I am new to R and would appreciate any advice! Thank you.
You could first transform your plot as a ggplot object and your last argument will work :