服务热线
178 0020 3020
library(maptools)
library(plyr)
library(ggplot2)
china_map<-readShapePoly(file.choose())
map <- fortify(china_map)
dat<-china_map@data
dat2 <- data.frame(dat,id=seq(0:924)-1)
merge_dat <- join(map, dat2, type = "full")
data=subset(merge_dat,NAME=="\272\332\301\372\275\255\312\241")
mytheme=theme_bw()+theme(panel.border = element_blank(),panel.grid.major = element_blank(),panel.grid.minor = element_blank(),axis.line = element_line(colour = "black"),legend.position = "none")
ggplot(data, aes(x = long, y = lat, group = group,fill=NAME))+geom_polygon(fill="blue")+geom_path(colour = "black")+geom_point(x=126.63,y=45.75,color="red")+annotate("text",x=127,y=46.3,label="Harbin",color="white")+mytheme+ggtitle("R2-21-Heilongjiang")
pop=read.csv("/R2-9-1地图绘图/R2-9-1.csv")
pop_map<-join(china_mapdata, pop, type = "full")
ggplot(pop_map, aes(x = long, y = lat, group = group,fill=pop))+geom_polygon( )+scale_fill_gradient(low = "white",high = "navy")+geom_path(colour = "grey")+mytheme+ggtitle("R2-21")
附件