Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
258 views
in Technique[技术] by (71.8m points)

dictionary - How to Create A City level Map with sp package on R

I am tring to learn spatial mapping on R and as a beginner I only managed to get the city level map plot right, however how can I change the color of specific cities? For instance I created a vector of cities, but I couldn't manage to merge them to plot via ggplot. Any help is appreciated. Thank you for your time.

require(tidyverse)
library(sp)
tur<- readRDS(url("https://biogeo.ucdavis.edu/data/gadm3.6/Rsp/gadm36_TUR_1_sp.rds"))
tur@data %>% as_tibble() %>% head(10) 
ggplot(tur, aes(x = long, y = lat)) + geom_polygon(aes(group = group)) + coord_fixed()
tur_for <- fortify(tur)
head(tur_for) 
ggplot(tur_for) + geom_polygon(aes(x = long, y = lat,group = group),color = "white",fill = "blue") + geom_polygon(aes(x = long, y = lat,group = group),color = "white",fill = "blue")+
  theme_void() + coord_fixed()

iller1 <- c("Afyonkarahisar", "Amasya", "Balikesir", "Corum", "Diyarbakir", "Erzurum", "Hatay", "Isparta",
            "Kahramanmaras", "Kars", "Konya", "Malatya", "Ordu", "Samsun", "Sivas", "Sanliurfa", "Tokat", "Trabzon", "Van",
            "Yozgat")
question from:https://stackoverflow.com/questions/66056293/how-to-create-a-city-level-map-with-sp-package-on-r

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...