Centering axes labels in echarts4r

987 views Asked by At

Is there a method to center axes labels and change their font size. By default, echarts4r puts them at the end as seen below. The code that generated it is:

as.data.frame(cars) %>%  e_charts(speed) %>% e_bar(dist) %>%
+     e_axis_labels( y = "Distance", x = 'Speed')

Figure:

Axes Labels

1

There are 1 answers

0
Adi On

John Coene answered the question on his github which I am pasting here for future reference [the bit in e_x_axis:

cars %>% 
  e_charts(dist) %>% 
  e_scatter(speed) %>% 
  e_x_axis(
    name = "SPEED",
    nameLocation = "middle",
    nameTextStyle = list(
      color = "red",
      fontSize = 24
    )
  )