Dear List,

I know this has been covered before, but I don't seem to be able to get it 
right.  I am constructing a boxplot in lattice and can't get the scales in the 
correct alphebetical order.  I have already read that this is due to the way 
factors are treated, and I have to redefine the levels of the factors.  
However, I have failed.  
As a simple example:

library(lattice)
id<-rep(letters[1:9], each=20)
x<-rep(seq(1:10),each=18)
y<-rnorm(180,50,20)

#Reverse alphebetical order
  bwplot(y~x|id, horizontal=FALSE)

#alphebetical order reading right to left
  id<-factor(id,levels = sort(id,decreasing = TRUE))
  bwplot(y~x|id, horizontal=FALSE)

It appears that bwplot plots scales from the bottom left to the top right. If 
so my factor levels would need to be levels=c(7,8,9,4,5,6,1,2,3). I tried that 
but can't seem to get the factor function to work.

#Did not work!
id<-factor(id,levels=c(7,8,9,4,5,6,1,2,3),lables=letters[1:9])

Your help would be greatly appreciated.

Tim





Tim Clark
Department of Zoology 
University of Hawaii

______________________________________________
R-help@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.

Reply via email to