0

使用 maps 包时,我在获取某个绘图布局时遇到了一些麻烦。这是我正在尝试的:

library(maps)
library(mapdata)
aa <- rep(1,5); ab <- c(2,3,1,1,1)
mat <- rbind(aa,aa,aa,ab)
layout(mat)
map('state', mar=c(0,0,0,0))
map('worldHires', region='USA:Alaska', xlim=c(-175,-120))
map('worldHires', region='Hawaii', xlim=c(-161,-154.5))

这是我收到的错误:

Error in plot.new() : plot region too large

通常我会弄乱边距来解决这个错误,但这似乎不起作用。有任何想法吗?

4

1 回答 1

4

您可以通过在绘制每个新地图之前设置边距来解决此问题:

layout(mat)
map('state')
par(mar=c(0,0,0,0))
map('worldHires', region='USA:Alaska', xlim=c(-175,-120), col="blue")
par(mar=c(0,0,0,0))
map('worldHires', region='Hawaii', xlim=c(-161,-154.5), col="blue")

在此处输入图像描述


通过https://stat.ethz.ch/pipermail/r-help/2006-September/113030.html

于 2012-08-24T16:23:06.620 回答