gvisGeoChart中的ISO代码不正确?

时间:2015-09-30 18:44:38

标签: r maps iso googlevis

我刚开始在R中使用googleVis,但遇到了一些麻烦。我想制作洪都拉斯各部门的等值地图;这是我的代码:

map_me <- data.frame(prov=c("HN-AT","HN-CH","HN-CL","HN-CM","HN-CP","HN-CR",
                            "HN-EP","HN-FM","HN-GD","HN-IB","HN-IN","HN-LE",
                            "HN-LP","HN-OC","HN-OL","HN-SB","HN-VA","HN-YO"),
                     x=c(0.47,0.32,0.31,0.25,0.24,0.41,0.40,0.38,0.43,0.29,
                         0.17,0.25,0.33,0.17,0.19,0.39,0.21,0.31))
g <- gvisGeoChart(map_me,locationvar='prov',colorvar='x',
                  options=list(region="HN",dataMode="regions"))
plot(g)

在弹出的浏览器窗口中,地图在洪都拉斯上正确放大,图例中的色标显示正确的限制(0.17-0.47)。我认为我有基于Wikipedia entry的正确的ISO 3116-2代码,但似乎无法将我的数据连接到地图位置。

有什么想法吗?

1 个答案:

答案 0 :(得分:1)

当其他所有方法都失败时,请阅读vignette。事实证明我需要设置正确的分辨率选项:

g <- gvisGeoChart(map_me,locationvar='prov',colorvar='x',
                  options=list(region="HN",resolution="provinces"))