Closed ezzetfa1 closed 3 years ago
I believe that behavior comes from using ggsurvplot. The theme properties need to be set within the ggsurvplot function. The properties cannot be changed the way you would change normal ggplot objects. I think you could change properties by changing what you input into ggtheme. I have never tried this myself, though.
If your example code also included code for creating a "dummy dataset," then we could directly run your code and try to investigate further. Without that, it's not possible for us to investigate further.
I was unable to change themes, e.g. label font, size, etc. nor able to add annotations. I created the function below that works, but failed when I added the line annotate("text", x =100, y = .25, label = "Some text")
K_M = function(DSet=temp3, time="time24", status="NewLesB", Groups="DD", Title="") { temp = DSet temp$time = temp[[time]] temp$status = temp[[status]] temp$Groups = temp[[Groups]]
km_fit <- survfit(Surv(time, status) ~ Groups, data = temp , conf.int = 0.90) gg <- ggsurvplot(km_fit, temp, conf.int = FALSE, ggtheme = xgx_theme()) gg <- gg + xgx_scale_x_time_units(units_dataset = "day", units_plot = "day") gg <- gg + ggtitle(Title) print(gg) }