##新地图包括港澳台--英文 setwd("E:Rproject") library(sp) library(maps) library(mapdata) library(maptools) library(ggplot2) library(rgdal) library(plyr) x=readOGR('bou2_4p.shp'); y=x@data #读取行政信息 xs=data.frame(y,id=seq(0:924)-1) #含岛屿共925个形状 pop = read.csv("Hazard-Level.csv",header=TRUE);head(pop) par(mar=c(3,3,1,1)) #边界控制:下左上右 gddat=fortify(x);head(gddat) gddat=transform(gddat,id=iconv(id,from='GBK'),group=iconv(group,from='GBK')) library(plyr) china_map_data=join(gddat,xs,type="full") #合并两个数据框 china_data=join(china_map_data,pop,type="full") #合并两个数据框 province_city=read.csv("china-provincecity.csv") #读取省会城市坐标 ggplot(china_data,aes(long,lat))+ expand_limits(gddat)+ geom_polygon(aes(group=group,fill=Hazard.Level),colour="black")+ scale_fill_gradient(low="darkred",high="white") + coord_map("polyconic") + annotate("text",x=105,y=35,label="Gansu")+ annotate("text",x=116.5,y=40.5,label="Beijing")+ annotate("text",x=117,y=39,label="Tianjin")+ annotate("text",x=115.5,y=38,label="Hehei")+ annotate("text",x=119.5,y=33.5,label="Jiangsu")+ annotate("text",x=112,y=30.5,label="Hubei")+ annotate("text",x=121,y=24,label="Taiwan")+ annotate("text",x=117.5,y=26,label="Fujian")+ annotate("text",x=97,y=36,label="Qinghai")+ annotate("text",x=112,y=21.5,label="Macao")+ annotate("text",x=115,y=22,label="Hong Kong")+ annotate("text",x=106,y=37,label="Ningxia")+ annotate("text",x=110.3,y=19.5,label="Hainan")+ annotate("text",x=107,y=41,label="Inner Mongolia")+ annotate("text",x=120,y=29,label="Zhejiang")+ annotate("text",x=127.5,y=47,label="Heilongjiang")+ annotate("text",x=112,y=28,label="Hunan")+ annotate("text",x=103,y=31,label="Sichuan")+ annotate("text",x=118,y=36.6,label="Shangdong")+ geom_text(aes(x=jd,y=wd,label=province),data=province_city) + theme( panel.grid = element_blank(), panel.background = element_blank(), axis.text = element_blank(), axis.ticks = element_blank(), axis.title = element_blank() )