本文介绍了如何在R中的美国地图中为州上色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想画一张美国地图,其中有些州为蓝色,另一些州为白色
I want to draw a US map with some states have blue color and others have white color
现在,我有了州名列表:
Now, I have the list of names of state:
c=c("ILLINOIS", "KANSAS","LOUISIANA","MAINE","MICHIGAN","MINNESOTA","MISSISSIPPI" )
但是,当我使用时:
map(database = "state",regions = c,col = "blue",fill=T)
它仅显示:
这不是我想要的,我想看到白色的其他状态,我该怎么办?
This is not I want, I want to see other states with white color, what should I do?
推荐答案
@rawr解决方案在注释中有效.创建具有填充颜色的完整地图:
@rawr solution in comments worked. to create a full map with fill colors:
map(database = "state")
map(database = "state",regions = c,col = "blue",fill=T,add=TRUE)
这篇关于如何在R中的美国地图中为州上色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!