thomasp85 / scico

Palettes for R based on the Scientific Colour-Maps
Other
411 stars 24 forks source link

Setting an exact midpoint for divergent palettes #12

Closed hinojojojo closed 2 years ago

hinojojojo commented 2 years ago

Hi, I recently discovered your package which have great palettes! and also pretty unique are the divergent palettes that doesn't have a middle color (e.g. roma, romaO, vikO). I am working on some maps where I am trying to use those divergent palettes that does not have middle colors, and I need to clearly distinguish which values are to the right or to the left of a middle value (e.g. 1). However I am having a hard time to find a way to set up my middle value of my variable of interest to be the exact middle value of the color palette. After doing a lot of math, and playing with "begin", "end" and "limits" arguments, I havent had a good success, but I have got close. What may be a proper way to achieve this?

As a feature request, it would be great to have a "midpoint" argument, similar to scale_*_gradient2 in ggplot.