Home > Enterprise >  Reorder legend survfit
Reorder legend survfit

Time:01-31

I have made a regression that looks like this:

survfit(Surv(YearsToEvent, Event) ~ CancerType, data = RegressionData)

From that I get an output table like this (I removed some of the columns for readability):

          n 
Cancer A  100  
Cancer B  200  

However, when I plot the output using ggsurvplot where I have a plot a table with "number at risk", I want to be able to manually adjust the order of the legend. That is, I want to be able to put Cancer B before Cancer A. I found a similar thread here on SO: enter image description here

  •  Tags:  
  • Related