[Suggestion] Three colour gradient: compute colours through the
Hi, nice work on the package!
I recently discovered your package. I have a similar package named
Looking at your source code, I found that you compute the gradient colours with the normalize function. While I was working on my package I found really useful the set of gradients used in
# Three colour gradient library(scales) data_vector <- c(-10, -4, -2, -1, 1, 4, 10) # Create palette: A gradient going from red to blue through white: colour_scale <- scales::div_gradient_pal(low = "red", mid = "white", high = "blue") # Rescale data: scaled_data <- scales::rescale_mid(data, mid = 0) # Apply colour scale to scaled data: data_colours <- colour_scale(scaled_data) # Print colour names: print(data_colours) #  "#FF0000" "#FFB29A" "#FFD9CB" "#FFECE5" "#F1E7FF" "#C4A2FF" "#0000FF"
The default palettes and options are well chosen, for instance they offer palettes for colorblind people (through the
Feel free to use it, if you like it. It saved me a lot of work and I feel it provides a well thought interface.
The text was updated successfully, but these errors were encountered: