【发布时间】:2015-05-06 12:19:27
【问题描述】:
我正在尝试使用新的 choroplethr 包根据某些指标(在工作中经历过事故的人口百分比)制作欧洲国家的 choropleth 地图。 这是一个可重现的示例,用于演示我需要解决的 2 个问题。
a<-c(4.1,2.5,0.4,6.4,1.4,1.8,3.8,1.3,2.3,8.4,5.2,1.9,0.8,1.5,2.1,1.2,3.8,1.4,3.1,0.8,4.0,1.3,4.8,2.6,2.8,2.3,3.1,2.5)
target<-c("austria","belgium","bulgaria","switzerland","cyprus","czech republic","denmark",
"estonia","spain","finland","france","greece","croatia","hungary","ireland","italy",
"lithuania","luxembourg","latvia","norway","poland","portugal","romania","sweden",
"slovenia","slovakia","turkey","united kingdom")
datas<-data.frame(region=target,value=a)
datas$region<-as.character(datas$region)
install.packages("choroplethr")
install.packages("choroplethrMaps")
library(choroplethr);library(choroplethrMaps)
data(country.map)
data(country.regions)
country_choropleth(datas,legend="%",num_colors=1,zoom=target)
1)我遇到的第一个深刻问题是这些属于某些国家(例如法国)的额外区域,并且不要让地图完全放大欧洲。
我给了缩放参数数据框中存在的国家的整个向量。
如果我尝试country_choropleth(datas,legend="%",num_colors=1,zoom="switzerland")
那么它只会放大瑞士
问题来自法国等国家
country_choropleth(datas,legend="%",num_colors=1,zoom="france")
所以我需要一种方法来脱离属于欧洲国家但不在欧洲地区的地区。有什么想法吗?
2) 我遇到的第二个问题是在country.regions$region 中存在与包一起使用的可用区域,缺少马耳他。它在地图上只有一个污点,但我还是不能跳过它。
有什么办法可以添加国家吗?
【问题讨论】:
-
第三,您还应该确保按照欧盟 JRC 的建议使用欧盟的兰伯特方位角等面积坐标系统。
标签: r google-maps choropleth choroplethr