[R] Change axes labels in Lattice

Oscar Rueda orp at intras.es
Tue Mar 12 15:02:07 CET 2002

Thanks to Mr. Lancelot, I've got to plot the "puzzle" plot for displaying a contingency table. Here's the code if someone is interested

V1<-factor(round(runif(100, 1,4)), labels=c("A", "B", "C", "D"))
V2<-factor(round(runif(100, 1,4)), labels=c("A", "B", "C", "D"))
V3<-factor(round(runif(100, 1,5)), labels=c("Val1", "Val2", "Val3", "Val4","Val5"))

s<-table(V1, V2, V3)

levelplot(Freq~unclass(V1)*unclass(V2)|V3, data=f, cuts=3, labels=F,xlab="V1", ylab="V2",
	scales=list(x=list(at=c(1,2,3,4), labels=levels(V1)),y=list(at=c(1,2,3,4), labels=levels(V2))),
	page=function(...) {
		grid.text(x = c(.76,.76),
                    y = seq(.8, .7, len = 2),label=c("Contingency Table", "V1 vs. V2"),gp=gpar(fontsize=17))


r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch

More information about the R-help mailing list