[R] tick marks: 0, 12, 24, 36 ...

Spencer Graves spencer.graves at pdf.com
Mon Oct 6 19:01:48 CEST 2003


Hopefully, someone who knows will answer.  In case that won't happen, 
I'll tell you what I would do that would likely produce the desired 
result fairly quickly -- but longer than it would take me to test it: 

1.  class(KM) = "survfit". 

2.  methods(plot) includes "plot.survfit". 

3.  ?plot.survfit reveals options I don't fully understand.  I'd work 
the examples and experiment to see if I could do what I wanted easily 
with the existing function. 

4.  If that didn't work, I'd list "plot.survfit", copy it to a file, 
find the "plot" command, and add "axes=FALSE" to the argument list.  I'd 
follow that with "axis(1, ...)" to add the x-axis I want and "axis(2)" 
to add the default y axis. 

      This general approach has worked in other contexts, so I believe 
something like this would likely work here. 

hope this helps.  spencer graves

Gabor Borgulya wrote:

>Dear R-help list,
>
>I have a problem with the tick marks of a Kaplan-Meier survival plot.
>Here is a sample:
>
>follow.up<-c(10,20,30,40,50,60,70,80,90,100) #months
>dead<-c(1,1,1,0,1,1,0,0,0,0)
>KM <-survfit(Surv(follow.up, dead))
>plot(KM)
>
>The result is a nice plot. However, our research group thinks it may be
>a better idea to place the ticks to the years on the time scale, i.e. 0,
>12, 24, 36 etc. months. Is this possible with R?
>
>I tried to look it up and the most relevant manual page was ?axis,
>option at - but I could not make this work together with the plot
>command. 
>
>plot(KM, axis=axis(1, at=c(0,12,24,36))) #this does not what I wanted
>
>Any ideas?
>
>
>Thank you,
>
>Gabor
>
>______________________________________________
>R-help at stat.math.ethz.ch mailing list
>https://www.stat.math.ethz.ch/mailman/listinfo/r-help
>  
>




More information about the R-help mailing list