[R] Hmisc::xYplot - text on xaxis

Andy Bunn Andy.Bunn at wwu.edu
Thu Apr 26 22:47:50 CEST 2012


Hello, I'm making a simple plot using xYplot in the Hmisc library and having problems with labeling the values on the x-axis. Using the reproducible example below, how can I have the text (jan, feb,mar, etc.) in place of 1:12. 

Thanks, AB


x <- c(seq(0,0.5,by=0.1),seq(0.5,0,by=-0.1))
ci <- rnorm(12,0,sd=0.1)
xupper <- x + ci
xlower <- x - ci
mo.fac <-  c("jan", "feb", "mar", "apr", "may", "jun", "jul",
         "aug", "sep", "oct", "nov", "dec")
foo <- data.frame(mo=1:12,mo.fac,x,xupper,xlower)

# example 1: works but I want text (jan, feb, etc.) and not numbers on the x axis
xYplot(Cbind(x,xlower,xupper) ~ mo,data=foo)

# example 2: doesn't work
xYplot(Cbind(x,xlower,xupper) ~ mo.fac,data=foo)



More information about the R-help mailing list