EmilHvitfeldt / paletteer

🎨🎨🎨 Collection of most color palettes in a single R package
https://emilhvitfeldt.github.io/paletteer/
Other
914 stars 45 forks source link

Center the divergent palette by 0 #121

Closed albert-ying closed 2 years ago

albert-ying commented 2 years ago

Hi, I'm wondering if it is possible to specify the divergent continuous palette to be centered by 0?

I tried paletteer::scale_fill_paletteer_c("pals::coolwarm", midpoint = 0) but it doesn't take midpoint argument.

Currently, my plot looks like this -- would be nice if I can set the midpoint in paletteer functions

image
EmilHvitfeldt commented 2 years ago

Hello @albert-ying 👋 This has been requested before https://github.com/EmilHvitfeldt/paletteer/issues/50. I'm hesitant to add this before it gets support in ggplot2 directly. Please see https://github.com/tidyverse/ggplot2/issues/3738 for ideas of how to deal with this problem. I also wrote this blogpost about ways to deal with this problem https://www.emilhvitfeldt.com/post/2019-05-21-center-continuous-palettes-in-ggplot2/