服务热线
178 0020 3020
library("ggplot2")
library("maptools")
library("rgdal")
library("plyr")
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")
guangdong_dat <- subset(merge_dat,NAME=="广东省")
ggplot(guangdong_dat, aes(x = long, y = lat, group = group,fill=NAME))+geom_polygon(fill="pink")+geom_path(colour = "grey40")+geom_point(x=113.14,y=23.08, fill="black")+annotate("text",x=113,y=23,label="guangzhou")+ggtitle("R2-09")
library("ggplot2")
library("maptools")
library("rgdal")
library("plyr")
library("mapproj")
map <- fortify(china_map)
dat<-china_map@data
dat2<-data.frame(dat,id=seq(0:924)-1)
merge_dat<-join(map,dat2,type = "full")
pop<-read.csv(file.choose(1))
merge_dat2<-join(merge_dat, pop, by = "NAME", type = "full")
mytheme<-theme(panel.background = element_blank(),panel.grid = element_blank(),axis.text = element_blank(),axis.ticks = element_blank(),axis.title = element_blank(),legend.position = c(1.0,0.5))
ggplot(merge_dat2, aes(x = long, y = lat, group = group,fill=pop))+geom_polygon( )+scale_fill_gradient(low = "white",high = "red")+geom_path(colour = "green")+ggtitle("R2-09 中国人口信息与行政区域结合图")+mytheme
附件