【问题标题】:How to color specific districts in a country map in R?如何在 R 中为国家地图中的特定区域着色?
【发布时间】:2020-07-29 16:17:41
【问题描述】:

我已经绘制了砂拉越州(在马来西亚国家)的地图以及地区级别的边界,如图所示。

但是我的问题是,如何为特定区域(两个或更多)着色?谁能帮助我,砂拉越的任何地区都可以作为例子。代码如下:

#sarawak map with divisions
library(raster)

#country Malaysia with all boundaries at the district level
Malaysia <- getData('GADM', country='MYS', level=2)
#listing all districts in every states in Malaysia e.g. there are 32 districts for Sarawak state
Malaysia$NAME_1

#plotting Sarawak with all districts and their boundaries
Sarawak <- Malaysia[98:128,]
plot(Sarawak)

【问题讨论】:

    标签: r mapping spatial


    【解决方案1】:

    首先让我推荐(向所有人)转到CRAN,单击“包”链接,然后单击“CRAN 任务视图”链接。该页面按一般适用范围收集软件包;有一整节是关于地图、测绘和 GEOS 等的。

    对于您的特殊情况,我认为 maptools here 包中的一些工具是为地图中的指定区域着色而设计的。

    【讨论】:

    • 感谢您的建议!一段时间后我已经能够弄清楚了。
    猜你喜欢
    • 1970-01-01
    • 2015-01-27
    • 1970-01-01
    • 1970-01-01
    • 2012-11-25
    • 1970-01-01
    • 2021-06-05
    • 2016-03-21
    • 1970-01-01
    相关资源
    最近更新 更多