【发布时间】:2013-04-02 20:50:22
【问题描述】:
我在 mapdata 包中使用此代码,但它只显示我选择的三个国家,而我看不到世界其他地区的地图边界。
map("world",
regions=c("ethiopia", "kenya", "uganda"),
exact = TRUE,
fill=TRUE,
col=c(1,2,3))
如何在突出显示我选择的三个国家的同时显示世界其他地区的地图边界?
【问题讨论】:
我在 mapdata 包中使用此代码,但它只显示我选择的三个国家,而我看不到世界其他地区的地图边界。
map("world",
regions=c("ethiopia", "kenya", "uganda"),
exact = TRUE,
fill=TRUE,
col=c(1,2,3))
如何在突出显示我选择的三个国家的同时显示世界其他地区的地图边界?
【问题讨论】:
这是一个没有 rworldmap 的例子:
require(mapdata)
# get the names
cc <- map('world', names = TRUE, plot = FALSE)
take <- unlist(sapply(c("ethiopia", "kenya", "uganda"), grep, tolower(cc), value = TRUE))
# world
map()
# add the selected countries in grey to the plot
map('world', regions=take, fill=TRUE, col='grey50', add = TRUE)
【讨论】:
bor = "red" 或类似名称,以更加突出所选国家/地区。