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 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…