x axis

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

x axis

Michela Ballardini
Hello,
I write to know how can I modify the x axis : when I plot a survival object, R plots a graph with x values = 0, 10, 20, 30 while I want a graph with values 0, 6, 12, 18, 24 in the x axis. How can I do this? In R 2.1.1 version there was "time.inc" in survplot, but in version R 2.2.0 there isn't it!

I am sorry for my english and I hope that you understand my problem.

Thank you
Michela

**************************************
Dr.ssa Michela Ballardini
UnitĂ  di Biostatistica e Sperimentazioni Cliniche
c/o Osp. Morgagni-Pierantoni - Pad. Valsalva
Via Forlanini, 34
47100 Forlì
Tel 0543-731836
Tel/Fax 0543-731612
**************************************


        [[alternative HTML version deleted]]


______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Reply | Threaded
Open this post in threaded view
|

Re: x axis

Marc Schwartz (via MN)
On Tue, 2005-12-20 at 12:56 +0100, Michela Ballardini wrote:

> Hello,
> I write to know how can I modify the x axis : when I plot a survival
> object, R plots a graph with x values = 0, 10, 20, 30 while I want a
> graph with values 0, 6, 12, 18, 24 in the x axis. How can I do this?
> In R 2.1.1 version there was "time.inc" in survplot, but in version R
> 2.2.0 there isn't it!
>
> I am sorry for my english and I hope that you understand my problem.
>
> Thank you
> Michela


I suspect that you are confusing the arguments available for
plot.survfit() which is in the 'survival' package as part of the
standard R installation, with survplot() which is in Frank Harrell's
'Design' package, which needs to be installed from CRAN.

The former does not have a 'time.inc' argument, while the latter does
(and still does).

You probably need to install Design in your updated R installation,
since under Windows (from your e-mail headers), R is installed in
version specific directories.

Then be sure to use library(Design) before using survplot().


Even with plot.survfit(), one can adjust the x axis labels by using
something like the following (an example from ?plot.survfit):

leukemia.surv <- survfit(Surv(time, status) ~ x, data = aml)


# Now compare the default labels here:
plot(leukemia.surv, lty = 2:3)


# With these:

# Set 'xaxt = "n"' so the x axis is not drawn
plot(leukemia.surv, lty = 2:3, xaxt = "n")

# Now draw x axis with labels every 6 months
# Make the font smaller to fit in this example
axis(1, at = seq(0, 172, 6), cex.axis = 0.5)


HTH,

Marc Schwartz

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html