Skip to content
Prev 385843 / 398503 Next

2 KM curves on the same plot

Hi Jim,

I tried points(-1,-1) before lines() and before clip(), but either way, it still shows everything, :-(

It's interesting that the examples with hist() provided by the R help of clip function works nicely.

I also tried a simple linear regression plots below, clip() works, too.

dat<-data.frame(x=1:10,y=1:10)
fit<-lm(y~x,dat)
plot(1:10)
abline(fit)
xylim<-par("usr")
clip(6,xylim[2],xylim[3],xylim[4])
abline(fit,col=2)? ? ## yes, it only shows the fit line from 6 to the right
lines(c(2,8),c(5,5))? ? ## yes, it only shows the line from 6 to the right

So it's puzzling that only when using lines() with a survfit() object (ovarian example below), somehow clip() doesn't work

John
On Tuesday, September 29, 2020, 07:58:53 PM PDT, Jim Lemon <drjimlemon at gmail.com> wrote:
Hi John,
I should have remembered this. For some reason, the clip() function
doesn't operate until you have issued a graphics command. Try:

points(-1,-1)

before calling lines()

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