我正在尝试使用新的 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
存在与软件包一起使用的可用区域的内部,缺少马耳他。它在地图上只有一个污点,但我还是不能跳过它。有什么办法可以添加国家吗?