install.packages("devtools")
library(devtools)
install.packages("curl")
library(curl)
install.packages("RCurl")
library(RCurl)
library(httr)
set_config( config( ssl_verifypeer = 0L ) )
install_github("Lchiffon/REmap")
#install.packages("REmap")
library(REmap)
options(remap.js.web = T)
#该函数在echart3.0更新时有bug,后来联系作者改了,如果是很久前下的REmap包,记得重新卸载该包后重新下载。
library(REmap)
destin <- read.csv(file="K:/Atest/destination.csv",encoding="gb2312",header=F)
head(destin)
names(destin) <- c("names","values")
markLine_data <- data.frame(origin=rep("上海",10),
destination=destin[1:10,1],
color=rep("#fff",10)
)
markPoint_data <- markLine_data[markLine_data!=""]
markPoint_data1 <- markPoint_data[which(markPoint_data!="广州"&markPoint_data!="#fff")] #作图时除去广州这个点及对应的#fff字符串
remapC(destin,
title="2016年2月6日 广州人口迁出图",
subtitle="前10目标省份",
theme=get_theme(
#设置相应的背景色调
theme="Dark",
lineColor = "#FFFFFF",
titleColor = "#fff",
borderColor = "#FFFFFF", #边界颜色
regionColor = "#000000", #区域颜色
pointShow = F,
pointColor = "gold"
),
color=c('#CD0000','#FFEC8B'), #颜色渐变方案,对应每个地区不同的value
markLineData=markLine_data,
markLineTheme=markLineControl(
color="white",
lineWidth=2,
lineType="dashed"
),
markPointData=markPoint_data1,
markPointTheme=markPointControl(
symbolSize=13,
effect=T,
effectType="scale",
color="white"
)
)