0
有人可以根據房地產數據集幫助我創建一個多邊形地圖(https://docs.google.com/spreadsheets/d/1g_awI6hnD80IVeZDOWpvU_NHdHxsk_Uyo8HML9p-yHo/edit#gid=0)嗎?我想用不同的顏色代表不同房地產價格的薩克拉門託區域地圖。R中的多邊形地圖(空間數據)
我在下面提供的代碼來自示例多邊形R代碼。我無法弄清楚多邊形地圖中的「合併」功能是如何工作的。
謝謝
#load libraries
library(ggmap)
library(ggplot2)
library(gpclib)
library(rgeos)
getClass("Polygon")
getClass("SpatialPolygons")
realestate.f <- fortify(realestate, region = "zip")
realestate.f <- merge(realestate.f, realestate, by.x = "longitude", by.y = "latitude")
head(realestate.f)
Map <- ggplot(realestate.f, aes(longitude, latitude, price)) +
geom_polygon() + coord_equal() +
labs(x = "longitude", y = "latitude", "price") +
ggtitle("Sacramento Real Estate Prices")
Map + scale_fill_gradient(low = "white", high = "black")`