我很抱歉,因为我很确定这是一个基本问题。我想做的就是使用maps包在R中创建一个非常简单的等值线地图。这是我第一次尝试在 R 中映射任何数据。
我所在的地区是美国本土 48 个州,包括华盛顿特区。这是我想要绘制的数据集的前几行。
> head(choro, n=7)
AL AR AZ CA CO CT DC
"red" "red" "red" "blue" "blue" "blue" "red"
当我尝试绘制基本地图时:
map("state",
regions = names(choro),
lty = 1, lwd =1,
boundary=TRUE,
fill=TRUE,
col=choro)
The 附图这是我所看到的。我是 R 新手,但我想未填写的状态没有正确合并,尽管我相信我正在使用“标准”状态缩写。
我做错了什么!/需要修复吗?
任何帮助将非常感激。
If you take out the regions=names(choro), you will get a more completely filled map. If you want the items that are probably missing from the choro vector to be drawn then why not substitute "white" as the color? If you need a more complete answer then provide a full copy of choro.
choro <- c( "red", "red", "red" ,"blue" ,"blue", "blue", "red")
require(maps)
data(state)
names(choro) <-names(state)[1:7]
map("state", lty = 1, lwd =1,
boundary=TRUE, fill=TRUE,
col=choro)
见附图:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)