How I can center a title on echarts4r?

Viewed 175

Hi and thanks for reading me Anyone knows how I can center a title on a plot maded with echarts4r? Im trying the following code, but it doesnt work:

df <- data.frame(
  x = LETTERS[1:5],
  y = runif(5, 1, 5),
  z = runif(5, 3, 10)
)

df |>
  arrange(y) |> 
  e_charts(x) |>
  e_bar(y) |>
  e_legend(FALSE) |> 
  e_title("Título ejemplo", align = "center") |> 
  e_flip_coords()

Hope anyone can help me, I don't find anything :(

1 Answers

This could be achieved by setting left = "center". See here.

df <- data.frame(
  x = LETTERS[1:5],
  y = runif(5, 1, 5),
  z = runif(5, 3, 10)
)

library(echarts4r)
library(dplyr)

df |>
  arrange(y) |> 
  e_charts(x) |>
  e_bar(y) |>
  e_legend(FALSE) |> 
  e_title("Título ejemplo", left = "center") |> 
  e_flip_coords()

enter image description here

Related