我正在嘗試使用ggplot2對美國和加拿大人口普查地圖進行rbind。地圖人口普查:rbind使用ggplot2強化R中的空間對象
us <- readOGR(dsn = "00-raw/usmaps/us/", layer = "co99_d90")
canada <- readOGR(dsn = "00-raw/gcd_000b11a_e/", layer = "canada")
canada$id <- as.numeric(canada$id)
us$id <- as.numeric(us$id)
canada$id <- canada$id + length(unique(us$id))
na <- rbind(canada, us)
p <- ggplot() +
geom_polygon(data = na, aes(x = long, y = lat, group = group, fill = pop),
color = "black", size = 0.25) +
theme_nothing(legend = TRUE)
但有一些奇怪的線。
的shape文件的來源如下:
http://www12.statcan.gc.ca/census-recensement/2011/geo/bound-limit/files-fichiers/gcd_000b11a_e.zip
www2.census.gov/geo/tiger/PREVGENZ/co/co90shp/co99_d90_shp.zip
我真的需要這些形狀文件,因爲我希望我的邊界代表美國和加拿大人口普查部門的縣。
你可以添加shapefile的來源嗎? – Alex
或者,也許可以確定你實際上正在嘗試完成什麼,因爲可能比使用兩個看起來隨機的形狀文件有更好的方法。 – hrbrmstr