generate very different colors [R] from unique categories

187 views Asked by At

Currently I have a data.table with a column named brand, where brand is a character column. I am using the following code to generate a color for each brand:

Library(viridis)

color.list <- df[, .(
  brand = sort(unique(brand)),
  brand.color = viridis::plasma(length(sort(unique(brand))))
)]

However when the data gets plotted some brands have different colors (ex. brand1 and brand2 have colors #DE6064FF and #E06363FF, respectively). However in practice these 2 colors don't differ too much (ex. both of them look like orange). How can I make the colors more different between them o they don't look the same

0

There are 0 answers