服务热线
178 0020 3020
> library(ggplot2)
> library(sp)
> library(maptools)
> library(rgdal)
> setwd("D:\\learningr")
> china_map<-readShapePoly("bou2_4p.shp")
> x<-china_map@data
> xs<-data.frame(x,id=seq(0:924)-1)
> china_mapdata<-join(china_map1, xs, type = "full")
> zhejiang<-subset(china_mapdata,NAME=="浙江省")
> ggplot(zhejiang, aes(x = long, y = lat, group = group,fill=NAME))+
+ geom_polygon(fill="beige" )+
+ geom_path(colour = "blue")+
+ ggtitle("R-40 中华人民共和国浙江省")+
+ geom_point(x=120.6,y=28.10,colour="red")+
+ annotate("text",x=120.6,y=28.3,label="温州市")
> install.packages("mapproj")
> library(maps)
> library(mapproj)
> mypop<-read.csv("D:\\learningr\\R2_9_2.CSV",head=TRUE)
> china_pop<-join(china_mapdata, mypop, type = "full")
> ggplot(china_pop, aes(x = long, y = lat, group = group, fill = pop)) +geom_polygon(colour="green") +scale_fill_gradient(low="grey",high="red") +coord_map("polyconic") +ggtitle("R2-40")
附件