[R] 2 KM curves on the same plot

array chip @rr@ypro|||e @end|ng |rom y@hoo@com
Tue Sep 29 02:33:23 CEST 2020


Hello,

Can anyone suggest a simple way to generate a Kaplan-Meier plot with 2 survfit objects, just like this one: 

https://drive.google.com/file/d/1fEcpdIdE2xYtA6LBQN9ck3JkL6-goabX/view?usp=sharing

Suppose I have 2 survfit objects: fit1 is for the curve on the left (survtime has been truncated to the cutoff line: year 5), fit2 is for the curve on the right (minimum survival time is at the cutoff line: year 5), but if I do the following:

plot(fit1, col=1:2)
lines(fit2,col=1:2)

Then I will have an horizontal line on the top that connect from 0 to 4 years, which I do not want that to be drawn (see blue arrow below):

https://drive.google.com/file/d/178mQGlhnaOg9PA-oE-W_W5CtrGD03ljH/view?usp=sharing

Can anyone have a strategy to make this kind of plot happen?

Thanks,

John



More information about the R-help mailing list