在使用简单函数图时,我知道如何绘制两个图:
old.par <- par(mfrow=c(1, 2))
plot(faithful, main="Faithful eruptions")
plot(large.islands, main="Islands", ylab="Area")
par(old.par)这会把某物归还:

我也需要对一个相当复杂的spplot函数做同样的操作。我想要的是3x3平方。
我要绘制9次的函数是:
labelat = fivenum(gwr.res$SDF$Unempl)
labeltext = labelat
spplot(gwr.res$SDF, "Unempl", cuts = 4, at = c(fivenum(gwr.res$SDF$Unempl)), col.regions = Greens,
colorkey=list(width=0.3,
space="right",
tick.number=5,
labels=list(
at=labelat,
labels=labeltext ))) 知道怎么解决这个问题吗?
谢谢,
发布于 2015-09-03 14:30:00
使用包grid.arrange gridExtra。执行grid.arrange(spplot(..),spplot(...),spplot(.....))等操作会将它们安排在一个网格中。
下面是一个使用meuse数据集的示例,该数据集生成9个这样的地块,然后使用do.call保存必须执行的grid.arrange(plots[[1], plots[[2]],操作,等等,最多可达9:
> require(gridExtra)
> plots = lapply(names(meuse)[1:9], function(.x) spplot(meuse,.x))
> do.call(grid.arrange,plots)

发布于 2016-04-28 17:43:07
或者更简单:
grid.arrange(spplot(df.voro2, "my.data", xlab = "x", ylab = "y", main = "my title") ,
spplot(df.voro, "dummy", xlab = "x2", ylab = "y2", main = "my title2" ))

https://stackoverflow.com/questions/32378151
复制相似问题