[R] changing plot symbol and/or size in plot(cox.zph)

David Winsemius dwinsemius at comcast.net
Sat Nov 21 23:42:32 CET 2009


On Nov 21, 2009, at 4:28 PM, <cryan at binghamton.edu> wrote:

> Is there a way to make the
>
> plot(cox.zph(model))
>
> use some other symbol than open circles?

Yes, but after looking at the code, the points call does not have  
trailing "..." so, not without modifying the function:

library(survival)
methods(plot)
getAnywhere(plot.cox.zph)

Now just hack the function:

plot.cox.zph
<gives you the function arguent list and body.

plot.cox.zph2 <-  <insert arguments and code here>

And change these lines:

+         if (resid)
+             points(xx, y)
+         lines(pred.x, yhat)

  to

+         if (resid)
+             points(xx, y, ...)
+         lines(pred.x, yhat)


Then using the example in help(cox.zph) :
plot.cox.zph2(temp, pch=4)  gives you "x"'s instead of "o"'s

--
David Winsemius, MD
Heritage Laboratories
West Hartford, CT




More information about the R-help mailing list