【问题标题】:How to create a map with zipcode dataset? ( US Zipcode ) [closed]如何使用邮政编码数据集创建地图? (美国邮政编码)[关闭]
【发布时间】:2017-01-27 08:38:37
【问题描述】:

如何在 R 中使用邮政编码数据集创建地图?

data <- c("22313","10100","25001") [示例邮政编码]

此时,我有一个充满邮政编码的数据集,我想在地图中打印并保存为 pdf。

最好的问候,

EP

【问题讨论】:

标签: r maps pdf-generation zipcode


【解决方案1】:

试试下面我从一月份在how do I map (on a geographical map) data in R just given the US Zipcodes修改的代码:

pdf("myzipcodes.pdf")
library(maps)
map(database="usa")# national boundaries

library(zipcode)
data("zipcode")
myzips <- c("22313","83701","32301")
selected <- zipcode[ zipcode$zip %in% myzips, ]
points( selected$longitude, selected$latitude, pch= 19, cex= 2 )
text( selected$longitude, selected$latitude, selected$zip, pos=3, cex= 2 )
dev.off()

你提供了两个虚假的邮政编码,所以我添加了几个真实的。

在 RStudio 中,您还可以使用“导出”菜单将绘图导出为 PDF 文件。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-10-09
    • 2019-02-25
    • 2017-09-18
    • 2010-12-02
    • 1970-01-01
    • 2011-01-28
    • 1970-01-01
    相关资源
    最近更新 更多