R2-40 第九期-地图

barcaqiu 2018-01-02 14:15:04 阅读: 1020

> 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="温州市")

Rplot-map1.png


> 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")


Rplot-map-2.png

 
邀请讨论

附件

{{f.title}} 大小 {{f.file_size}} 下载 {{f.count_download}} 金币 {{f.count_gold}}
{{item.nick_name}} 受邀请回答 {{item.create_time}}
{{item.refer_comment.nick_name}} {{item.refer_comment.create_time}}

附件

{{f.title}} 大小 {{f.file_size}} 下载 {{f.count_download}} 金币 {{f.count_gold}}
切换到完整回复 发送回复
赞({{item.count_zan}}) 踩({{item.count_cai}}) 删除 回复 关闭
科研狗©2015-2024 科研好助手,京ICP备20005780号-1 建议意见

服务热线

178 0020 3020

微信服务号