Skip to content
Prev 385851 / 398503 Next

2 KM curves on the same plot

Hi Jim,

I found out why clip() does not work with lines(survfit.object)!

If you look at code of function survival:::lines.survfit, in th middle of the code:

? ? do.clip <- getOption("plot.survfit")
? ? if (!is.null(xx <- do.clip$plotclip))?
? ? ? ? clip(xx[1], xx[2], xx[3], xx[4])

This will reset the clipping to the defualt plot region!

So I just comment out the last 2 lines of the above 3 lines, and created a customized lines2 function. Now it works!

It's fun to learn clip().

Thanks,

John
On Wednesday, September 30, 2020, 01:47:55 AM PDT, Jim Lemon <drjimlemon at gmail.com> wrote:
Hi John,
Hmmm, this works:

plot(1:10)
xylim<-par("usr")
clip(5,xylim[2],xylim[3],xylim[4])
lines(10:1)

so I suspect that there is a "lines" method that resets the clipping
region out of sight. Fortunately Mark Schwartz provided a way to get
your plot so I will give the wall against which I have been banging my
head a break.

Jim
On Wed, Sep 30, 2020 at 1:57 PM array chip <arrayprofile at yahoo.com> wrote: