ggplot2 | R语言绘制世界地图choropleth

直接开始,先下载地图:

library(tidyverse)# 下载形状文件,注意改destfile的路径
download.file("http://thematicmapping.org/downloads/TM_WORLD_BORDERS_SIMPL-0.3.zip" , 
              destfile="E:/code/R_code/ggplot2/world_shape_file.zip")# 这个时候去看一下路径里是不是有了world_shape_file.zip这个文件

然后直接打开文件夹手动解压(因为我试了用代码解压好像不太行)图片
解压之后读入文件:


# Read this shape file with the rgdal library. 

你可能感兴趣的:(R语言,r语言,开发语言)