Dear R-help list members, I am trying to create my own axes when plotting a cumulative incidence curve using the plot.cuminc function in the CMPRSK library. The default x-axis places tick marks and labels at 0, 20, 40, 60, and 80 (my data has an upper limit of 96), whereas I want them at my own specified locations. Here is my example code: library(cmprsk) attach(MYDATA) MYCUMINC <- cuminc(ftime=TIME,fstatus=STATUS,group=GROUP,rho=0,cencode=0,na.action=na.omit) plot(MYCUMINC,xlim=c(0,96),ylim=c(0,0.5),xlab="",axes=F) axis(1,at=c(0,8,16,24,32,48,72,96)) As you can see, I have tried using the "axes=F" parameter that works for most plotting functions, but I get the following error message: Error in legend(wh[1], wh[2], legend = curvlab, col = color, lty = lty, : unused argument(s) (axes ...) Is there anyway I can get a customized x-axis when using the plot.cuminc function? I have searched online and R help manuals to no avail and would GREATLY appreciate your input. Please let me know if you need additional info from me. Thanks, Amy [[alternative HTML version deleted]]
Arthur Allignol
2008-Dec-10 14:24 UTC
[R] controlling axes in plot.cuminc (cmprsk library)
Hi, You could try to use the option xaxt = "n" in plot.cuminc, instead of axes. Hope that helps, Arthur Amy Krambrink wrote:> Dear R-help list members, > > I am trying to create my own axes when plotting a cumulative incidence > curve using the plot.cuminc function in the CMPRSK library. The default > x-axis places tick marks and labels at 0, 20, 40, 60, and 80 (my data has > an upper limit of 96), whereas I want them at my own specified locations. > Here is my example code: > > library(cmprsk) > attach(MYDATA) > > MYCUMINC <- > cuminc(ftime=TIME,fstatus=STATUS,group=GROUP,rho=0,cencode=0,na.action=na.omit) > > plot(MYCUMINC,xlim=c(0,96),ylim=c(0,0.5),xlab="",axes=F) > axis(1,at=c(0,8,16,24,32,48,72,96)) > > As you can see, I have tried using the "axes=F" parameter that works for > most plotting functions, but I get the following error message: > > Error in legend(wh[1], wh[2], legend = curvlab, col = color, lty = lty, : > > unused argument(s) (axes ...) > > Is there anyway I can get a customized x-axis when using the plot.cuminc > function? I have searched online and R help manuals to no avail and would > GREATLY appreciate your input. Please let me know if you need additional > info from me. > > Thanks, > Amy > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >