r2-21-第九次作业-地图

R30-椰z 2018-01-02 23:12:57 阅读: 1274

library(maptools)

library(plyr)

library(ggplot2)

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

data=subset(merge_dat,NAME=="\272\332\301\372\275\255\312\241")

mytheme=theme_bw()+theme(panel.border = element_blank(),panel.grid.major = element_blank(),panel.grid.minor = element_blank(),axis.line = element_line(colour = "black"),legend.position = "none")

ggplot(data, aes(x = long, y = lat, group = group,fill=NAME))+geom_polygon(fill="blue")+geom_path(colour = "black")+geom_point(x=126.63,y=45.75,color="red")+annotate("text",x=127,y=46.3,label="Harbin",color="white")+mytheme+ggtitle("R2-21-Heilongjiang") 

9-1.png

 pop=read.csv("/R2-9-1地图绘图/R2-9-1.csv")

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

ggplot(pop_map, aes(x = long, y = lat, group = group,fill=pop))+geom_polygon( )+scale_fill_gradient(low = "white",high = "navy")+geom_path(colour = "grey")+mytheme+ggtitle("R2-21")

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-2025 科研好助手,京ICP备20005780号-1 建议意见

服务热线

178 0020 3020

微信服务号