echarts4r将情节向下移动以为传奇腾出空间

时间:2018-05-04 04:43:07

标签: r echarts

有没有办法将地块向下移动,以便在图例和绘图区域之间有一些空间?理想情况下,图表区域会自动间隔在图例下方。

df <- data.frame(
  x = seq(50),
  y = rnorm(50, 10, 3),
  z = rnorm(50, 11, 2),
  w = rnorm(50, 9, 2)
)

df %>% 
  e_charts(x) %>% 
  e_line(w) %>% 
  e_line(y) %>%  
  e_line(z) %>%
  e_legend(orient = 'vertical', left = 0, top = 0)

Plot

1 个答案:

答案 0 :(得分:2)

使用e_grid功能调整绘制图表的“网格”。

library(echarts4r)

df <- data.frame(
    x = seq(50),
    y = rnorm(50, 10, 3),
    z = rnorm(50, 11, 2),
    w = rnorm(50, 9, 2)
)

df %>% 
    e_charts(x) %>% 
    e_line(w) %>% 
    e_line(y) %>%  
    e_line(z) %>%
    e_legend(
      orient = 'vertical', 
      left = 0, 
      top = 0,
      selectedMode = "single" # might be of use
    ) %>% 
    e_grid(left = 100, top = 5)

可以在网格中找到更多选项here