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)
#該函數(shù)在echart3.0更新時(shí)有bug,后來(lái)聯(lián)系作者改了,如果是很久前下的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")]? ? ? #作圖時(shí)除去廣州這個(gè)點(diǎn)及對(duì)應(yīng)的#fff字符串
remapC(destin,
title="2016年2月6日 廣州人口遷出圖",
subtitle="前10目標(biāo)省份",
theme=get_theme(
#設(shè)置相應(yīng)的背景色調(diào)
theme="Dark",
lineColor = "#FFFFFF",
titleColor = "#fff",
borderColor = "#FFFFFF",? #邊界顏色
regionColor = "#000000",? #區(qū)域顏色
pointShow = F,
pointColor = "gold"
),
color=c('#CD0000','#FFEC8B'),? #顏色漸變方案,對(duì)應(yīng)每個(gè)地區(qū)不同的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"
)
)