I want to plot a pie chart and give each value a fixed color. Give the e_color()
function a named list does unfourtunately not work. Any suggestions?
library(tibble)
library(echarts4r)
tibble(class=c("A", "B"), n=c(34,12)) %>%
e_charts(class) %>%
e_pie(n) %>%
e_color(color = c("A" = "red", "B" = "yellow"))
Note: I use the pie chart in a shiny app where the values for class
can take on different values depending on user input. Sometimes only class A occurs, sometimes A,B,C and so on, whereby the colors of the different values of class
should always remain the same.