簡體   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