R2 第九期 地图

Giant Panda 2018-01-01 22:29:57 阅读: 1001

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


44444.png


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

5555.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

微信服务号