R2-06 地图作业

dean 2018-01-01 22:01:05 阅读: 1309

part1


library(maptools)

library(ggplot2)

library(plyr)

library(rgdal)


china_map<-readShapePoly("bou2_4p.shp")

jingweidu<-china_map@data

xingzhengquyu<-data.frame(jignweidu,id=seq(0:924)-1)

china_map1<-fortify(china_map)9_1.png



china_mapdata<-join(china_map1, xingzhengquyu, type = "full") 

hebei<-subset(china_mapdata,NAME=="河北省")

ggplot(hebei, aes(x = long, y = lat, group = group,fill=NAME))+

  geom_polygon(fill="yellow" )+

  geom_path(colour = "grey40")+

  ggtitle("R2-06-dean-SJZ")+

  geom_text(mapping = aes(x=117,y=35,label=NAME),color="red",cex=5)+

  geom_point(aes(x=114.48,y=38.03),colour="blue",size=1.8)+

  annotate("text",x=115.48,y=38.03,label="石家庄")+

    coord_map("polyconic")



part2


pop<-read.table(file.choose(),header = T,sep = ",")


china_pop<-join(china_mapdata, pop, type = "full")


ggplot(china_pop, aes(x = long, y = lat, group = group, fill=pop))+

  

  geom_polygon(colour="green")+

  

  scale_fill_gradient(low="white",high="red") +

  

  coord_map("polyconic") +

  

  ggtitle("R2-06-dean")

9_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

微信服务号