Skip to content
Prev 177430 / 398503 Next

Lattice xyplot with text under x-axis

Still on this question, I'm having problems with displaying the text when
repeated values are present. For example:

library(lattice)
year<-c(2001,2002,2003,2001,2002,2003,2001,2002,2003,2001,2002,2003)
fac<-c("arts","arts","arts","arts","arts","arts","sci","sci","sci","sci","sci","sci")
type<-c("est","est","est","early","early","early","est","est","est","early","early","early")
staff<-c(95,98,99,32,31,36,57,52,55,24,23,26)
part<-c(32,31,33,15,16,14,40,41,43,15,17,19)
df1<-data.frame(year,fac,type, staff,part)

n.val.text<-paste("n = ", df1$staff, sep = "")

xyplot(part~year | type+fac, as.table=TRUE, type="o",
between=list(x=1,y=1),xlab="",ylab="",
scales = list(relation = "free", x = list(at = year, labels =paste(year,
n.val.text, sep = "\n")))) 

This attempts to place all the values of "staff" under each year. Is there a
any way to correct this?

http://www.nabble.com/file/p23103168/lattice_xyplot_with_axis_text.png
Deepayan Sarkar wrote: