我正在尝试使用 R 函数来设置复杂的图形排列layout
包装的graphics
.
x <- y <- seq(-4*pi, 4*pi, len = 27)
r <- sqrt(outer(x^2, y^2, "+"))
当我只使用用该函数创建的图时image
,事情按预期工作,如下所示
M=matrix(c(1,2,3,4,5,4),3,2, byrow=T)
M
layout(M)
layout.show(5)
image(z = r, main="plot1")
image(z = r, main="plot2")
image(z = r, main="plot3")
image(z = r, main="plot4")
image(z = r, main="plot5")
dev.off()
但是,当我尝试使用image.plot
,为了获得色阶,不再遵循布局,如下所示
layout(M)
layout.show(5)
library(fields)
image.plot(z = r, main="plot1")
image.plot(z = r, main="plot2")
image.plot(z = r, main="plot3")
image.plot(z = r, main="plot4")
image.plot(z = r, main="plot5")
dev.off()
我怀疑这个问题可能来自以下事实:image.plot
划分绘图区域。我也尝试过使用split.screen
这似乎效果更好,但我更喜欢使用layout
对于非常复杂的安排来说可能更容易。