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

Uwe Ligges ligges at statistik.uni-dortmund.de
Mon Oct 6 18:41:48 CEST 2003


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

Almost. See ?axis:

  plot(KM, xaxt="n")
  axis(1, at = seq(0, 100, 12))

Uwe Ligges


> 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