r - Second and third Kaplan Meier plots exceeding set x limit -
as can see picture above, second , third kaplan meier curves exceed x-limit , box set.
i used exact same code 3 plots, changing actual survival object each time, y-axis labels , ranges. x-limit , labels same every plot. example of code below:
par(mfrow=c(2,2)) surv.obj <- survfit(surv(start, stop, event) ~ factor(characteristic), data=dataset) par( mai=c(2,3,1.5,0.42) ) colours <- c("gray0", "gray75") # x-axis max( unlist(unname(summary(surv.obj)["time"] )) ) # 1274 plot(surv.obj, mark.time=f, col=colours, lty=1, lwd=2, yscale=100, xscale=1, fun="event", ylab="", xlab="follow-up (days)", xlim=c(0, 1280), xaxt="n", axes=f, cex.lab=1.8, cex.main=1.8 ) box("plot", lty=1) axis(2, cex.axis=1.5, at=c(0, 0.04, 0.08, 0.12, 0.16) ) axis(1, cex.axis=1.5, at=c(0, 300, 600, 900, 1200) )
with repeated 2 times next 2 curves.
i know not 'plot specific' code issue, because when plot each 1 separately (and ignore par(mfrow=c(2,2))) produced way want them (with survival curve cut-off @ approx 1280 days). also, tried plotting second , third plots using par(mfrow=c(1,2)) , first 1 turned out fine (which second 1 in plot in picture) , second 1 again exceeded box.
does know why happening , how fix it?
thanks vicki
Comments
Post a Comment