From jerome@hivnet.ubc.ca  Wed Oct 16 17:46:12 2002
From: jerome@hivnet.ubc.ca (jerome@hivnet.ubc.ca)
Date: Wed, 16 Oct 2002 18:46:12 +0200 (MET DST)
Subject: xlim in plot.survfit() [with a discussion on "..."] (PR#2173)
Message-ID: <200210161646.SAA00608@pubhealth.ku.dk>

Full_Name: Jerome Asselin
Version: 1.6.0
OS: RedHat 7.2
Submission from: (NULL) (24.83.203.63)



Hello,

I am trying to draw a legend on top of survival curves using
plot.survfit(). As in the example below, I would like to
specify a large interval for the x-axis. I can achieve such
result using "xlim". However, an error occurs if I use the
legend.pos and legend.text parameters as well.

  library(survival)
  TIME  <- Surv(c(23,52,12,56,23,21),c(T,F,T,F,F,T))

  par(mfrow=c(2,1))
  plot(survfit(TIME~1),conf.int=F,xlim=c(0,100),
  main="xlim=c(0,100) without legend")
  plot(survfit(TIME~1),conf.int=F,xlim=c(0,100),
  legend.pos=0,legend.text="Survival Curve",
  main="xlim=c(0,100) with legend (ERROR!)")

It looks like plot.survfit() attempts to send the "xlim"
parameter to legend(), which does not accept "xlim" as a
parameter. Hence, an error occurs and the legend is not
plotted.

I believe the problem is due to the fact that the
additional parameters "..." that are supplied to
plot.survfit() do not necessarily match the range of
possible parameters for both plot() and legend(). In my
case, "xlim" is matched by plot(), but not by legend().

I know how to plot the legend by directly using the
legend() function. However, in order to correct the
small problem with plot.survfit(), I would suggest that
plot.survfit() be modified to perform an exact match of
the parameters in "..." onto legend(). Perhaps there is
already a function to perform such a task. If not, I
believe it could provide a practical solution for
dealing with "..." and subfunctions that do not have a
built-in "..." parameter. That's just a suggestion,
though.

Thank you very much!
Jerome Asselin


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


xlim in plot.survfit() [with a discussion on "..."] (PR#2173)
jerome@hivnet.ubc.ca