Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Centering axes labels in echarts4r

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

like image 220
Adi Avatar asked Dec 02 '25 11:12

Adi


1 Answers

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
    )
  )
like image 159
Adi Avatar answered Dec 04 '25 01:12

Adi



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!