Is it possible to change the colour palette using the function e_visual_map
from the package echart4r
.
The default is the following.
library(tidyverse)
library(echarts4r)
data(mtcars)
mtcars |>
e_charts(mpg) |>
e_scatter(wt, qsec, scale = e_scale) |>
e_visual_map(qsec, scale = e_scale)
For example, is it possible to use the Viridis colour palette from the package ggplot2?
CodePudding user response:
You can add color
as an additional argument, then you can input viridis
as the parameter. Or you can put in a list of colors (e.g., color = c("#8DD3C7", "#FFFFB3", "#BEBADA", "#FB8072")
).
library(tidyverse)
library(echarts4r)
library(viridis)
mtcars |>
e_charts(mpg) |>
e_scatter(wt, qsec, scale = e_scale) |>
e_visual_map(qsec, scale = e_scale, color = viridis(5))