1.安装包,加载包
install_github('lchiffon/REmap')
install_github('badbye/baidumap')
library(devtools)
library(REmap)
library(baidumap)
2.载入数据
setwd("D:/本人信息/生信小书生/R语言绘图/2022-3-19-地图/知乎杜雨数据/DataWarehouse-master/Rstudy/热力图")
province <- mapNames("china") #全国省份
value <- rnorm(34,100,30) #随机生成分省值
![辽宁省热力图.png](https://upload-images.jianshu.io/upload_images/25700846-36a25adfe35f49b7.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
mydata <- data.frame(province,value)
3.绘图
remapC(mydata,color=c("yellow","red"),title="全国分省热地图",subtitle="副标题") #制作热力图
4.辽宁省热力图
ad_ln <- mapNames("liaoning")
value_ln<-rnorm(14,100,30)
data_ln <-data.frame(ad_ln,value_ln)
map_out <- remapC(data_ln,
maptype = "liaoning",
color=c("green"),
title="辽宁省热力地图",
theme = get_theme("Sky"),
maxdata=180)
map_out