[R] Survplot, Y-axis in percent
David Winsemius
dwinsemius at comcast.net
Tue Nov 6 20:06:08 CET 2012
On Nov 6, 2012, at 8:10 AM, maziar.mohaddes wrote:
> Hi
>
> I am a new fan of R after getting mad with the graphical functional in SPSS.
> I have been able to create a nice looking Kaplan Meyer graph using Survplot
> function.
> However I have difficulties in turning the y axis to percent instead of the
> default 0-1 scale.
> Further I have tried the function yaxt="n" without any results. Any help in
> this matter will be appreciated.
> The code is posted below:
>
> par(mfrow=c(1,1))
> fit <- survfit(Surv(revreg$Tcuprev , revreg$Rcup_n_j_n)~revreg$RAceGrp_1Maz)
Probably better in the future to supply a data argument and then you formula only needs the column names.
> fit
> survplot (fit, col=c("gray1","gray40"), lty=1, lwd = 1,
> col.fill=c("gray50","gray80"),
> mark.time= T, conf="bands" , conf.int=.95, add=F ,
> xlim=c(0, 20) , time.inc = 4,
> ylim=c(0.5, 1),
> xlab="Years Postoperative" , ylab="Cumulative Survival
> Probability" ,
> label.curves=F , abbrev.label=F ,
> yaxt="n"
> )
As far as I can see, survplot.survfit (from package rms) is written with base graphics, so you need to suppress the default axis call with yaxt=FALSE, and replace it with your desired values using axis(2, at=..., labels=...). No testing in the absence of data.
>
> View this message in context: http://r.789695.n4.nabble.com/Survplot-Y-axis-in-percent-tp4648572.html
> Sent from the R help mailing list archive at Nabble.com.
You should also realize that Nabble is not Rhelp.
--
David Winsemius, MD
Alameda, CA, USA
More information about the R-help
mailing list