echarts4r 将绘图向下移动以为图例腾出空间

echarts4r moving the plot down to make room for the legend

有没有办法将绘图向下移动,使图例和绘图区域之间有一些 space?理想情况下,图表区域自动位于图例下方 spaced。

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)

使用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