7

パッケージmapdataを使用してこのコードを使用していますが、選択した 3 つの国のみが表示され、残りの世界の地図の境界は表示されません。

map("world", 
    regions=c("ethiopia", "kenya", "uganda"), 
    exact = TRUE, 
    fill=TRUE, 
    col=c(1,2,3))

選択した 3 つの国をハイライトしながら、世界地図の残りの境界線を表示するにはどうすればよいですか?

4

1 に答える 1

10

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)

ここに画像の説明を入力

于 2013-04-02T21:11:13.723 に答える