我已设法使用scale=list((alternating=3))
在@KoenV解决的水平图中标记辅助X轴:How to Add Labels to Top X-Axis of Levelplot in Lattice Package
现在,通过运行下面的代码,可以将主要X轴标签复制到辅助X轴上。但是,我需要在辅助X轴上添加不同的标签。
有谁知道怎么做?
在下面的示例中,我希望将'hor'作为主X轴标签,将'hor2'作为辅助X轴标签。
library(lattice)
#Build the horizontal and vertical axis information
hor <- c("214", "215", "216", "224", "211", "212", "213", "223", "226", "225")
hor2 <- paste("5", hor, sep="")
ver <- paste("DM1-", hor, sep="")
#Build the fake correlation matrix
nrowcol <- length(ver)
cor <- matrix(runif(nrowcol*nrowcol, min=0.4), nrow=nrowcol, ncol=nrowcol, dimnames = list(hor, ver))
for (i in 1:nrowcol) cor[i,i] = 1
#Build the plot
rgb.palette <- colorRampPalette(c("blue", "yellow"), space = "rgb")
levelplot(cor, main="stage 12-14 array correlation matrix", xlab="", ylab="", col.regions=rgb.palette(120), cuts=100, at=seq(0,1,0.01), scales=list(x=list(at=1:10, labels=hor, rot=90, alternating=3), y=list(at=1:10, labels=ver)))
谢谢!