xlim in plot.survfit() [with a discussion on "..."] (PR#2173)
Wed, 16 Oct 2002 18:46:12 +0200 (MET DST)
Full_Name: Jerome Asselin
OS: RedHat 7.2
Submission from: (NULL) (220.127.116.11)
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.
TIME <- Surv(c(23,52,12,56,23,21),c(T,F,T,F,F,T))
main="xlim=c(0,100) without legend")
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
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,
Thank you very much!
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: email@example.com