我试图策划一个美国州,加利福尼亚州:
map('state', region = c('CA')
我得到了一个很好的情节:
然而,国家很小。我似乎无法找到有关如何调整图像大小的任何论据。我尝试了一些可能在ggplot中使用的常见解决方案,例如
map('state', region = c('CA'), height=600, width=800)
但没有任何改变。任何建议都会挽救生命。感谢。
答案 0 :(得分:3)
如果您可以使用ggplot2
,则调整大小会更容易:
library(sp)
library(maps)
library(maptools)
library(ggplot2)
calif <- map_data('state', region="CA")
calif.df <- fortify(calif)
gg <- ggplot()
gg <- gg + geom_map(data=calif.df, map = calif.df,
aes(map_id=region, x=long, y=lat),
fill="white", color="black")
gg <- gg + coord_map()
gg <- gg + labs(x="", y="")
gg <- gg + theme(plot.background = element_rect(fill = "transparent", color = NA),
panel.border = element_blank(),
panel.background = element_rect(fill = "transparent", color = NA),
panel.grid = element_blank(),
axis.text = element_blank(),
axis.ticks = element_blank(),
legend.position = "right")
gg