繁体   English   中英

Levelplot布局不起作用R

[英]Levelplot layout not working R

鉴于levelplot objectspoint data ,怎么可以安排从1至图9,从1row 1 ,而不是我在下面的图片中得到了什么?

# install.packages("gridExtra")
require(gridExtra) # also loads grid
require(lattice)
x <- seq(pi/4, 5 * pi, length.out = 100)
y <- seq(pi/4, 5 * pi, length.out = 100)
r <- as.vector(sqrt(outer(x^2, y^2, "+")))

grid <- expand.grid(x=x, y=y)
grid$z <- cos(r^2) * exp(-r/(pi^3))
plot1 <- levelplot(z~x*y, grid, cuts = 50, scales=list(log="e"), xlab="",
                   ylab="", main="Weird Function", sub="with log scales",
                   colorkey = FALSE, region = TRUE)

plot2 <- levelplot(z~x*y, grid, cuts = 50, scales=list(log="e"), xlab="",
                   ylab="", main="Weird Function", sub="with log scales",
                   colorkey = FALSE, region = TRUE)

plot3 <- levelplot(z~x*y, grid, cuts = 50, scales=list(log="e"), xlab="",
                   ylab="", main="Weird Function", sub="with log scales",
                   colorkey = FALSE, region = TRUE)

plot4 <- levelplot(z~x*y, grid, cuts = 50, scales=list(log="e"), xlab="",
                   ylab="", main="Weird Function", sub="with log scales",
                   colorkey = FALSE, region = TRUE)

plot5 <- levelplot(z~x*y, grid, cuts = 50, scales=list(log="e"), xlab="",
                   ylab="", main="Weird Function", sub="with log scales",
                   colorkey = FALSE, region = TRUE)

plot6 <- levelplot(z~x*y, grid, cuts = 50, scales=list(log="e"), xlab="",
                   ylab="", main="Weird Function", sub="with log scales",
                   colorkey = FALSE, region = TRUE)

plot7 <- levelplot(z~x*y, grid, cuts = 50, scales=list(log="e"), xlab="",
                   ylab="", main="Weird Function", sub="with log scales",
                   colorkey = FALSE, region = TRUE)

plot8 <- levelplot(z~x*y, grid, cuts = 50, scales=list(log="e"), xlab="",
                   ylab="", main="Weird Function", sub="with log scales",
                   colorkey = FALSE, region = TRUE)

plot9 <- levelplot(z~x*y, grid, cuts = 50, scales=list(log="e"), xlab="",
                   ylab="", main="Weird Function", sub="with log scales",
                   colorkey = FALSE, region = TRUE)


a <- c(plot1, plot2,plot3,plot4,plot5,plot6,plot7,plot8,plot9, layout = c(3, 3))

update(a,strip = strip.custom(factor.levels = c("1","2","3","4","5","6","7","8","9"),
       par.strip.text=list(cex=1.0),bg=list(col="gray95")))][1]][1]

在此处输入图片说明

尝试这个:

a <- c(plot7,plot8,plot9,plot4,plot5,plot6,plot1,plot2,plot3, layout = c(3, 3))

update(a, strip = strip.custom(
    factor.levels = c("7","8","9","4","5","6","1","2","3"),
    par.strip.text=list(cex=1.0), bg=list(col="gray95")))

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM