我想使用 R 生成一个非常基本的世界地图,其中包含一组特定的国家,这些国家用红色填充,表示它们是疟疾流行国家。
我在数据框中列出了这些国家/地区,但我很难将它们覆盖在世界地图上。
I have tried using the wrld_simpl
object and also the joinCountryData2Map
method in the rworldmap
package.
I would comment on this answer to prevent addition of a possibly redundant question but I do not have enough reputation at the moment, apologies for this.
https://stackoverflow.com/a/9102797/1470099
I am having difficulty understanding the arguments given to the plot()
command - I wondered if there was just an easy way to tell R to plot all of the country NAMEs in my list on the wrld_simpl
map instead of using grepl()
etc. etc.
plot(wrld_simpl,
col = c(gray(.80), "red")[grepl("^U", wrld_simpl@data$NAME) + 1])