e61-Institute / theme61

Create graphs in the e61 Institute style
https://e61-institute.github.io/theme61/
MIT License
5 stars 0 forks source link

Change scale_fill/colour_e61 to auto detect the number of factors #30

Closed aaronw22 closed 10 months ago

aaronw22 commented 1 year ago

I believe Grattan's scale function can do this, but it would require us to reengineer scale_colour_e61() to work the way theirs does.

Seems to use ggplot2::discrete_scale which requires us to supply 2 new/changed things: a scale_name, which needs to be something called e61_palette which is a list of colours, and a palette, which might work with the existing scale_colour_e61 and needs to return a vector of colours given an integer argument.

Links for reference:

https://github.com/grattan/grattantheme/tree/master/R https://github.com/grattan/grattantheme/blob/master/R/grattan_pal.R https://github.com/grattan/grattantheme/blob/master/R/grattan_scales.R