I would like to create a graph with the package echarts4r, with the following data:
group_size <- 20
n_groups <- 13
df <- data.frame("day" = rep(1:group_size, times=n_groups),
"temperature" = runif(group_size * n_groups, 10, 40),
"location" = rep(LETTERS[1:n_groups], each=group_size)) %>%
mutate("other" = if_else((day %% 2) == 0, "A1", "A2"))
the graph I would like (with ggplot) :
df %>%
ggplot()+ geom_line(aes(x= day, y = temperature, color = location))+
facet_wrap(~other)
How to reproduce it with echarts4r (how to specify a color for each location for example )
I tried
df |>
group_by(other) |>
e_charts(day) |>
e_line(temperature) |>
e_facet(rows = 2, legend_pos = "top", legend_space = 12)