echarts4r是 R 中的一个画图工具包,作者是 John Coene。这个包的名字读起来是 Echarts for R,顾名思义就是在 R 中应用 Apache Echarts。Apache ECharts 是一个基于 JavaScript 的开源可视化图表库,官网有中英两种语言的文档,对英文阅读水平弱一些的小伙伴比较友好。
echarts4r 包的语法非常简洁,很容易上手,很多时候我们只需要从官网复制一个例子的代码就能画出图来。只不过,现实中画图用的数据往往不如案例中那么友好,笔者整理了一些犄角旮旯里的画图细节,希望能对用 echarts4r 包画图的小伙伴们有帮助。
本文章共分为四个部分:
  1. 基本语法:横轴、纵轴、多个变量、双Y轴、堆叠(阶梯瀑布图)、转置、反向、分组、时间轴(动态排序图)。
  2. 组件:通用设置(格式化文本)、标题、图例、数据标签(富文本)、提示框、数据标注、数据区域缩放、工具栏、视觉映射、自定义图形、排列组合、连接、嵌套。
  3. 坐标系:直角坐标系、极坐标系、单轴、日历、地理坐标系、平行坐标系。
  4. 主题:选择主题、背景颜色、线的属性(坐标轴轴线、坐标轴刻度线、坐标轴分割线、数据标签的视觉引导线)、文本属性(坐标轴标题、坐标轴标签、图表标题、图例、数据标签、提示框)、图形属性。
本篇推送将介绍后两章及全文小结。

3. 坐标系

3.1. 直角坐标系(Grid)

echarts4r 包绘制直角坐标系上的图形时,必须从e_charts()函数中引入唯一变量作为横轴,因此可以将一个图形容器分为上下两片、左右两片,但不能分为上下左右四片。
  • 将一个直角坐标系的图形容器分为上下两片:
data |>

e_charts(month) |>

e_line(Evaporation, name = "蒸发量") |>

e_line(Precipitation,

name = "降水量",

x_index = 1,

y_index = 1

) |>

e_grid(height = "35%") |> # 网格高度

e_grid(height = "35%", top = "60%") |>

e_y_axis(

gridIndex = 1,

name = "主Y轴",

nameLocation = "center",

nameGap = 30

) |>

e_x_axis(

gridIndex = 1,

name = "主X轴",

nameLocation = "end"

) |>

e_y_axis(

index = 1,

name = "次Y轴",

nameLocation = "center",

nameGap = 30

) |>

e_x_axis(

index = 1,

name = "次X轴",

nameLocation = "end"

)

  • 将一个直角坐标系的图形容器分为左右两片:
data |>

e_charts(month) |>

e_line(Evaporation, name = "蒸发量") |>

e_line(Precipitation,

name = "降水量",

x_index = 1,

y_index = 1

) |>

e_grid(width = "30%") |> # 网格宽度

e_grid(width = "30%", left = "50%") |>

e_y_axis(gridIndex = 1) |>

e_x_axis(gridIndex = 1)

3.2. 极坐标系(Polar)

在极坐标系上绘制图形时,在e_angle_axis()函数中设定角度轴,在e_radius_axis()设定径向(半径)轴。

3.2.1. 设定角度轴

echarts()中的数据放入角度轴时,相当于把直角坐标系中的横轴卷起来。
data |>

e_charts(month) |>

e_polar() |>

e_angle_axis(month) |>

e_radius_axis() |>

e_bar(Evaporation, name = "蒸发量", coord_system = "polar") |>

e_line(Precipitation, name = "降水量", coord_system = "polar")

3.2.2. 设定径向轴

echarts()中的数据放入径向轴时,相当于把直角坐标系中的纵轴卷起来。
data |>

e_charts(month) |>

e_polar() |>

e_angle_axis() |>

e_radius_axis(month, axisLabel = list(interval = 0)) |>

e_bar(Evaporation,

name = "蒸发量",

coord_system = "polar",

stack = "堆一堆"

) |>

e_bar(

Precipitation,

name = "降水量",

coord_system = "polar",

stack = "堆一堆"

)

3.3. 单轴(SingleAxis)

单轴坐标系通常被应用到散点图中。
data |>

e_charts(month, height = 120) |> # 设置图形容器的高度

e_single_axis(

bottom = 30,

left = 50,

axisLabel = list(interval = 0)

) |> # 单轴横轴标签间隔为0

e_scatter(

serie = Evaporation,

name = "蒸发量",

size = Temperature, # 点的大小

coord_system = "singleAxis"

)

多个单轴散点图可以结合
e_arrange()
组合在一起:

data.single <- data.frame(

hours = c(

"12a", "1a", "2a", "3a", "4a", "5a", "6a", "7a", "8a", "9a", "10a", "11a",

"12p", "1p", "2p", "3p", "4p", "5p", "6p", "7p", "8p", "9p", "10p", "11p"

),

Saturday_value = c(1:24),

Saturday_size = sample(0:14, 24, replace = TRUE),

Sunday_value = c(1:24),

Sunday_size = sample(0:14, 24, replace = TRUE)

)


e1 <- data.single |>

e_charts(hours, height = 100) |> # 横轴

e_single_axis(

bottom = 20,

left = 150,

axisLabel = list(interval = 2)

) |>

e_scatter(Saturday_value, # 纵轴

Saturday_size, # 气泡大小

scale_js = "function (dataItem) {return dataItem[2] * 4;}", # 写入JavaScript语言的缩放函数

color = "#5470c6", # 气泡颜色

coord_system = "singleAxis"

) |>

e_legend(show = FALSE) |>

e_title("Saturday", left = "left", top = "middle")


e2 <- data.single |>

e_charts(hours, height = 100) |>

e_single_axis(

bottom = 20,

left = 150,

axisLabel = list(interval = 2)

) |>

e_scatter(

Sunday_value,

Sunday_size,

color = "#fc8452",

scale_js = "function (dataItem) {return dataItem[2] * 4;}",

coord_system = "singleAxis"

) |>

e_legend(show = FALSE) |>

e_title("Sunday", left = "left", top = "middle")


e_arrange(e1, e2, cols = 1)

3.4. 日历(Calendar)

  • 展示一个月:
dates <-

seq.Date(as.Date("2021-01-01"), as.Date("2021-12-31"), by = "day")

values <- rnorm(length(dates), 20, 6)


year <- data.frame(date = dates, values = values)


year |>

e_charts(date, height = 200) |>

e_calendar(range = "2021-09", orient = "vertical") |> # 垂直布局

e_heatmap(values, coord_system = "calendar") |>

e_visual_map(max = 30)

  • 展示多个月:
year |>

e_charts(date, height = 200) |>

e_calendar(range = c("2021-01", "2021-07"), orient = "horizontal") |> # 水平布局

e_heatmap(values, coord_system = "calendar") |>

e_visual_map(max = 30)

3.5. 地理坐标系(Geo)

3.5.1. 世界地图

cns <- countrycode::codelist$country.name.en

cns <- data.frame(

country = cns,

value = runif(length(cns), 1, 100)

)


cns |>

e_charts(country) |> # 国家

e_map(value) |>

e_visual_map(value)

3.5.2. 中国地图

echarts4r.maps
包内置的中国地图缺少南海及九段线等内容,本节会给出正确的绘图姿势。

本节需要先额外安装一个存放在 Github 上的 R 包 echarts4r.maps
# install.packages("remotes")

remotes::install_github('JohnCoene/echarts4r.maps')

library(echarts4r.maps)


df <- data.frame(

region = c("湖北", "浙江", "北京", "广东"),

value = c(1, 2, 3, 4)

)


df |>

e_charts(region) |> # 区域

em_map("China") |>

e_map(value, map = "China") |>

e_visual_map(value)

不难发现,echarts4r.maps 内置的中国地图是不完整的,缺少南海诸岛及九段线等内容。因此,需要获取完整正确的地图,高德和百度都是具有甲级测绘资质的单位。下面采用阿里 DataV 数据可视化平台开放出来的地图数据,它来自高德开放平台。地图数据包含行政唯一编码、行政单位名称和行政级别(省、市和县三级),先将数据集保存到本地,数据映射到地图时,需要保证数据集中的行政单位名称和背景地图中的行政单位名称是一一对应的。
# 准备数据集

df <- data.frame(

region = c("湖北省", "浙江省", "北京市", "广东省"),

value = c(1, 2, 3, 4)

)

# 从本地加载新的正确的中国地图数据

china_map <- jsonlite::read_json("data/中华人民共和国.json")

# 开始绘图

df |>

e_charts(region) |>

# 注册地图

e_map_register("China2", china_map) |>

# 调用注册的地图

em_map("China2") |>

# 将数据映射到地图上

e_map(value, map = "China2") |>

e_visual_map(value)

3.5.3. 区域地图

用 echarts4r 包绘制省份和城市级别的地图时均需要导入一份可用的地图文件,本小节均是从阿里 DataV 数据可视化平台下载地图 json 文件。

3.5.3.1. 省级地图

绘制一个省份的地图,以湖北省为例。
json.province <- jsonlite::read_json('data/湖北省.json')


df.province <- data.frame(

city = c(

'武汉市',

'黄石市',

'十堰市',

'宜昌市',

'襄阳市',

'鄂州市',

'荆门市',

'孝感市',

'荆州市',

'黄冈市',

'咸宁市',

'随州市',

'恩施土家族苗族自治州',

'仙桃市',

'潜江市',

'天门市',

'神农架林区'

),

value = sample(1:10, 17, replace = TRUE)

)


df.province |>

e_charts(city) |>

# 注册地图

e_map_register("湖北省", json.province) |>

# 调用注册的地图

e_map(value, map = "湖北省") |>

e_visual_map(value)

3.5.3.2 市级地图

绘制一个城市的地图,以武汉市为例。
json.city <- jsonlite::read_json("data/武汉市.json")


df.city <- data.frame(

city = c("江岸区", "江汉区", "汉阳区", "武昌区", "洪山区"),

value = sample(1:10, 5)

)


df.city |>

e_charts(city) |>

e_map_register("武汉市", json.city) |>

e_map(value, map = "武汉市") |>

e_visual_map(value)

3.5.4. 坐标连线(lines)

lines <- data.frame(

source_lat = c(39.9109, 39.9109, 31.2359, 31.2359),

source_lon = c(116.4133, 116.4133, 121.4805, 121.4805),

source_name = c("北京", "北京", "上海", "上海"),

target_lat = c(31.2359, 22.5484, 39.9109, 22.5484),

target_lon = c(121.4805, 114.0645, 116.4133, 114.0645),

target_name = c("上海", "深圳", "北京", "深圳"),

cnt = sample(1:10, 2)

)


lines |>

e_charts() |>

e_geo(map = "China2") |>

e_lines(

source_lon, # 起点经度

source_lat, # 起点纬度

target_lon, # 终点经度

target_lat, # 终点纬度

source_name, # 起点城市

target_name, # 终点城市

cnt,

coord_system = "geo", # 地理坐标系

name = "线的名字",

lineStyle = list(normal = list(

curveness = 0.3, # 线的弯曲度

color = "red", # 线的颜色

width = 2

))

) |> # 线宽

e_tooltip(

trigger = "item",

formatter = htmlwidgets::JS(

"function(params){

return(

params.seriesName +'<br />' +

params.data.source_name + ' -> ' +

params.data.target_name + ':'+ params.value)}"

)

)

3.5.5. 地图上增加散点图

df <- data.frame(

lat = c(39.9109, 31.2359, 22.5484),

lon = c(116.4133, 121.4805, 114.0645),

city = c("北京", "上海", "深圳"),

value = c(10, 20, 30)

)


df |>

e_charts(lon) |>

em_map("China2") |>

e_geo(map = "China2") |>

e_scatter(lat, value, coord_system = "geo", scale = NULL) |>

e_legend(show = FALSE)

3.6. 平行坐标系(parallel)

echarts4r 包在应用平行坐标系时,group_by()函数不起作用。
parallel <- data.frame(

date = c(1:31),

AQIindex = sample(1:300, 31),

PM25 = sample(1:250, 31),

PM10 = sample(1:300, 31),

CO = sample(0:5, 31, replace = TRUE),

NO2 = sample(1:140, 31),

SO2 = sample(1:80, 31),

level = sample(c("优", "良", "轻度污染", "中度污染", "重度污染"), 31, replace = TRUE)

)


parallel |>

e_charts() |>

e_parallel(date,

AQIindex,

PM25,

PM10,

CO,

NO2,

SO2,

level,

opts = list(smooth = FALSE)

)

4. 主题

改主题主要是修改图形容器中出现的线、图形、文本的属性,即改动lineStyle()itemStyle()textStyle()中的参数。

4.1. 选择主题(theme)

echarts4r包官网提供了很丰富的主题样式,不喜欢默认主题的话,可以换其他的主题。
  • 主题:inspired
data |>

e_charts(month) |>

e_bar(Evaporation, name = "降水量") |>

e_line(Precipitation, name = "蒸发量") |>

e_theme("inspired")

  • 主题:dark-fresh-cut
data |>

e_charts(month) |>

e_bar(Evaporation, name = "降水量") |>

e_line(Precipitation, name = "蒸发量") |>

e_theme("dark-fresh-cut")

4.2. 背景颜色(color)

  • 指定背景颜色,标签与网格线的属性会自动改变:
data |>

e_charts(month) |>

e_bar(Evaporation, name = "蒸发量") |>

e_labels() |>

e_color(background = "black")

  • 同时修改图形的颜色和背景颜色:
data |>

e_charts(month) |>

e_bar(Evaporation, name = "蒸发量") |>

e_labels() |>

e_color("orange", "lightgrey") # 第一个引号里指定的是图形的颜色,第二个引号里指定的是背景的颜色

4.3. 线的属性(lineStyle)

4.3.1. 坐标轴轴线(axisLine)

  • symbol = c("none", "arrow")表示只在轴线末端显示箭头,默认symbol="none"即不显示箭头,symbol="arrow"即两端都显示箭头。
  • symbolSize = c(20, 15)箭头的大小,第一个数字表示宽度(垂直坐标轴方向),第二个数字表示高度(平行坐标轴方向)。
data |>

e_charts(month) |>

e_bar(Evaporation, name = "蒸发量") |>

e_y_axis(

name = "Y轴",

axisLine = list(

show = TRUE, # 显示坐标轴轴线

symbol = c("none", "arrow"),

symbolSize = c(20, 15), # 箭头的大小

lineStyle = list(

color = "red", # 轴线的颜色

width = 2, # 轴线的线宽

type = "dashed", # solid为实线,dashed为虚线,dotted为点线

opacity = 0.5 # 轴线的透明度

)

)

)

4.3.2. 坐标轴刻度线(axisTick)

data |>

e_charts(month) |>

e_bar(Evaporation, name = "蒸发量") |>

e_y_axis(

name = "Y轴",

axisLine = list(show = TRUE),

axisTick = list(

show = TRUE, # 显示坐标轴刻度

inside = TRUE, # 刻度朝内,默认朝外

length = 10, # 刻度的长度

lineStyle = list(

color = "red", # 刻度线的颜色

width = 5, # 刻度线的线宽

type = "solid", # 刻度线的类型

opacity = 0.5 # 刻度线的透明度

)

)

) |>

e_x_axis(

boundaryGap = TRUE,

axisTick = list(alignWithLabel = TRUE)

) # 使刻度线和标签对齐

4.3.3. 坐标轴分割线(splitLine)

data |>

e_charts(month) |>

e_bar(Evaporation, name = "蒸发量") |>

e_bar(Precipitation, name = "降水量") |>

e_y_axis(

name = "Y轴",

axisLine = list(show = TRUE),

splitLine = list(

show = TRUE, # 显示坐标轴分割线

lineStyle = list(

color = "red", # 分割线的颜色

width = 2, # 分割线的线宽

type = "dashed", # 分割线的类型

opacity = 0.5 # 分割线的透明度

)

)

) |>

e_x_axis(

type = "category", # 类目轴

splitLine = list(

show = TRUE, # 显示坐标轴分割线

interval = 1, # 坐标轴分隔线的显示间隔

lineStyle = list(

color = "red", # 分割线的颜色

width = 2, # 分割线的线宽

type = "dashed", # 分割线的类型

opacity = 0.5 # 分割线的透明度

)

)

)

4.3.4. 数据标签的引导线(LabelLine)

  • maxSurfaceAngle设置为小于 90 度的值保证引导线不会和扇区交叉。
  • 也可以在labelLine()通过设置lineStyle=list()改变引导线的颜色、线宽、类型、透明度等等属性。
data |>

e_charts(month) |>

e_pie(Evaporation,

name = "蒸发量",

radius = "40%"

) |>

e_labels(

position = "outside", # 显示数据标签的引导线

fontSize = 9,

alignTo = "edge", # 对齐方式

formatter = "名称:{b} \n 值:{c} 单位",

minMargin = 5,

edgeDistance = 10,

lineHeight = 15,

distanceToLabelLine = 1,

labelLine = list(

length = 20,

length2 = 0,

maxSurfaceAngle = 80

)

) |>

e_legend(type = "scroll")

4.4. 文本属性(TextStyle)

  • 可以改文本属性的有:坐标轴标题、坐标轴标签、图表标题、图例、数据标签、提示框。
data |>

e_charts(month, height = 400) |>

e_bar(Evaporation, name = "蒸发量") |>

e_line(Precipitation, name = "降水量", color = "red") |>

e_x_axis(

name = "X轴的名称",

nameLocation = "center",

nameTextStyle = list(color = "red"), # 修改坐标轴标题的文字属性

axisLabel = list(color = "orange")

) |> # 修改坐标轴标签的文字属性

e_y_axis(

name = "Y轴的名称",

nameTextStyle = list(color = "red"), # 修改坐标轴标题的文字属性

axisLabel = list(color = "orange")

) |> # 修改坐标轴标签的文字属性

e_title(

text = "主标题",

textStyle = list(color = "lightblue")

) |> # 修改图表标题的文字属性

e_legend(

textStyle = list(color = "lightgreen"), # 修改图例的文字属性

itemStyle = list(color = "grey"), # 修改图例的图形属性

lineStyle = list(color = "red") # 修改图例的图形中线的属性

) |>

e_labels(

show = TRUE,

position = "top",

color = "green"

) |>

e_tooltip(

show = TRUE,

trigger = "axis",

textStyle = list(color = "pink")

)

  • 以坐标轴标题为例。
data |>

e_charts(month, height = 400) |>

e_bar(Evaporation, name = "蒸发量") |>

e_x_axis(

name = "X轴\n的名称",

nameLocation = "center",

nameGap = 45,

nameTextStyle = list(

color = "red", # 颜色

fontStyle = "normal", # 字体风格,还有italic/oblique

fontWeight = "bolder", # 字体粗细,还有normal/bold/lighter

fontFamily = "Microsoft YaHei", # 字体系列

fontSize = 12, # 字体大小

align = "center", # 字体水平对齐方式,还有left/right

verticalAlign = "middle", # 字体垂直对齐方式,还有top/bottom

lineHeight = 10, # 字体行高,默认56

backgroundColor = "grey", # 文字块背景颜色

borderColor = "blue", # 文字块边框颜色

borderWidth = 2, # 文字块边框宽度

borderType = "dashed", # 文字块边框描边类型

borderDashOffset = 0, # 虚线偏移量

backgroundColor = "lightgrey", # 字块背景颜色

borderRadius = 20, # 文字块的圆角

padding = c(1, 2, 3, 6), # 文字块的内边距,(上,右,下,左)

shadowColor = "red", # 文字块背景阴影颜色

shadowBlur = 2, # 文字块背景阴影长度

shadowOffsetX = 1, # 文字块背景阴影X偏移

shadowOffsetY = 1, # 文字块背景阴影Y偏移

width = 20, # 文字本身的显示宽度

height = 20, # 文字本身的显示高度

textBorderColor = "blue", # 文字本身的描边颜色

textBorderWidth = 0.2, # 文字本身的描边宽度

textBorderType = "solid", # 文字本身的描边类型

textBorderDahOffset = 0 # 文字本身虚线描边时的偏移量

)

)

关于文字本身还可以调整的有:
  1. textShadowColor 阴影颜色;
  2. textShadowBlur 阴影长度;
  3. testShadowOffsetX 阴影X偏移;
  4. testShadowOffsetY 阴影Y偏移;
  5. overflow 文字超出宽度是否截断或换行,详见链接。

4.5. 图形属性(itemStyle)

每种图形的图形属性都是可以改的,以柱状图为例。
data |>

e_charts(month, height = 400) |>

e_bar(

Evaporation,

name = "蒸发量",

itemStyle = list(

color = "lightblue", # 柱条的颜色

borderColor = "red", # 柱条的描边颜色

borderWidth = 1, # 柱条的描边宽度

borderType = "dashed", # 柱条的描边类型,还有solid、dotted

borderRadius = 5, # 柱条的四个圆角半径

shadowBlur = 10, # 图形阴影的模糊大小

shadowColor = "lightgrey", # 图形阴影的颜色

shadowOffsetX = 2, # 阴影水平方向上的偏移距离

shadowOffsetY = 2, # 阴影垂直方向上的偏移距离

opacity = 1 # 图形透明度,为0时不绘制该图形

)

) |>

e_legend(itemStyle = list(

borderType = "dashed",

borderWidth = 0.8

)) |>

e_aria(enabled = TRUE, decal = list(show = TRUE)) # 贴花

5. 本文小结

这篇文章的题目叫做《echarts4r:从入门到应用》,意思是只要入门就能上手用了。入门也非常简单,去 echarts4r 包的官网复制几个例子,然后粘贴到自己电脑上跑起来就行了。如果嫌 echarts4r 包官网给出的例子太简单的话,就去 Apache Echarts 官网示例中找些相中的图形尝试着用 echarts4r 来复现。这里的「相中」并不是指从 Apache Echarts 官网找到想要复现的图形以后,就一定要死磕到底,在决定死磕之前最好先看看完整的 TS (Typescript)或 JS (JavaScript)代码,要是遇到 option = { } 前后有很多看不懂的代码,就别随便瞎碰乱试了,因为试不出来的原因很可能是现在的 echarts4r 包确实画不出来。
把 Apache Echarts 中的 JS 或 TS 代码转换成 echarts4r 中的 R 代码通常也有规律可循。其一,JS 里面定义参数是用冒号,如type:'category',而 R 里面则使用等号,如type = "category"。其二, JS 里面定义一个列表使用大括号,如axisTick:{ show:false },而 R 里面则用list(),如axisTick = list(show = TRUE)。其三, JS 里面定义数组使用中括号,如padding:[3, 4, 5, 6],而 R 里面则用c(),如padding = c(1, 1, 5, 6)
综合起来,当看到 Apache Echarts 官网的示例代码中有这样的片段:
xAxis:[{

type
:
'category'
,

  axisTick:{

    show:
false
  },

  nameTextStyle:{

    padding:[3, 4, 5, 6]

  }

}]

就可以在 R 里面加载 library(echarts4r) 后,写出下面这段。
e_x_axis(

  type = 
"category"
,

  axisTick = list(show = 
TRUE
),

  nameTextStyle = list(padding = c(
1
1
5
6
))

)

R 里面还有一个有趣的函数htmlwidgets::JS()可以帮我们直接引用 JS 代码。比如,Apache Echarts 官网有个例子中有这样一段:
visualMap:[{

  show:
false
,

  dimension:3,

  categories:data.counties,

  inRange:{

    color:(
function
 () {

      var colors = [
'#51689b'
'#ce5c5c'
]

return
 colors.concat(colors)

    })()

  }

}]  


在 R 里面就可以这样写:
e_visual_map(

  show = 
FALSE
,

  dimension = 
3
,

# 对应 categories:data.counties
  categories = c(
'Australia'
,
'Canada'
,
'China'
,
'Cuba'
,
'Finland'
,
'France'
,··· ,
'United States'
), 

  inRange = list(

    color = htmlwidgets::JS(

"(function () {

              // prettier-ignore

              var colors = ['#51689b', '#ce5c5c'];

              return colors.concat(colors);

            })()"

    )

  )

)

总而言之,上手试试,碰碰钉子,死磕几回,琢磨琢磨,自然就会了。

注. 环境信息

在 RStudio IDE 内编辑本文的 R Markdown 源文件,用 blogdown 构建网站,Hugo 渲染 knitr 之后的 Markdown 文件,得益于 blogdown 对 R Markdown 格式的支持,图、表和参考文献的交叉引用非常方便,省了不少文字编辑功夫。文中使用了多个 R 包,为方便复现本文内容,下面列出详细的环境信息:
xfun::session_info(packages = c(

"knitr", "rmarkdown", "blogdown",

"echarts4r.maps", "echarts4r", "countrycode"

), dependencies = FALSE)

参考文献

  1. Coene, John. 2019. Echarts4r.maps: Maps for Echarts4r. http://echarts4r-maps.john-coene.com/. ———. 2021. Echarts4r: Create Interactive Graphs with Echarts JavaScript Version 5. https://CRAN.R-project.org/package=echarts4r.
  2. Xie, Yihui, Alison Presmanes Hill, and Amber Thomas. 2017. Blogdown: Creating Websites with R Markdown. Boca Raton, Florida: Chapman; Hall/CRC. https://bookdown.org/yihui/blogdown/.

资源链接

  1. echarts4r 包官网:https://echarts4r.john-coene.com/
  2. Echarts 官网:https://echarts.apache.org/examples/zh/index.html
  3. 阿里 DataV 数据可视化平台:http://datav.aliyun.com/portal/school/atlas/area_selector
查看前两章内容:echarts4r: 从入门到应用(上),或点击阅读原文阅读全文。
编辑 | 周瑾纯
统计之都:专业、人本、正直的中国统计学社区。
关注方式:扫描下图二维码。或查找公众帐号,搜索 统计之都 或 CapStat 即可。
往期推送:进入统计之都会话窗口,点击右上角小人图标,查看历史消息即可。
继续阅读
阅读原文