r - 如何使用 R 绘制大陆 map ?

标签 r plot maps

在国家级别绘制 map 有很多解决方案,但就我而言,我想在大陆级别打印统计数据。

我唯一想到的是使用国家级 map 并使用每个大陆的国家列表,但我想知道这种 map 是否有任何简单的解决方案。为了实现我的想法,它会是这样的:

## produce the world map
map()
## list of countries per continent
SA <- c("argentina", "bolivia", "brazil", "chile", "colombia", "ecuador", "guyana", "paraguay", "peru", "suriname", "uruguay", "venezuela")
map(regions = SA, fill=TRUE, add=TRUE)

worldmap

最佳答案

rworldmap具有将数据绘制或聚合到区域级别(包括大陆)的功能。

一个简单的开始,应该产生下面的情节:

library(rworldmap)
#get coarse resolution world from rworldmap
sPDF <- getMap()  
#mapCountries using the 'continent' attribute  
mapCountryData(sPDF, nameColumnToPlot='continent')

或者对于 7 大洲模型:
mapCountryData(sPDF, nameColumnToPlot='REGION')

要将您自己的数据从国家/地区汇总到区域级别,请查看:
?mapByRegion

rworldmap continent map

关于r - 如何使用 R 绘制大陆 map ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20146809/

相关文章:

R 插入符包错误 - 至少一个类级别不是有效的 R 变量名称

r - 如何将优化用作求解器?

c++ - 如何使用 wxMathPlot 绘制 "real-time"图?

javascript - 谷歌热图根据强度改变颜色

r - R如何看待日期向量?

r - 数据分组与 Pandas group-by 和 grouper 相当

r - 使用 slider 绘制 3d 图形以控制绘制的点数

qt - 在 Qt 中使用像素图或位图快速绘图

android - 尝试从 Google Cloud Messaging 消息更改 Google Maps v2 Api 上的标记时出现非法状态异常

android - 在 android 中快速和频繁的位置更新..?