Description
scale_[fill/color]_discrete
currently default to scale_[fill/color]_hue
. While this is a great default when there are a large number of levels to encode, it's not a great default there are just a few (i.e., it's not colour-blind safe or aesthetically pleasing compared to carefully chosen qualitative palettes like colorbrewer or Okabe-Ito). In the event there isn't already a "blessed" ggplot2 scale (e.g., scale_colour_brewer()
), the usual way to override the default is with a custom qualitative colorscale is to use scale_[fill/color]_manual()
, but this also isn't ideal for situations where you don't want to make any assumptions about the number of levels to encode (i.e., scale_[fill/color]_manual()
errors if there are more levels than color codes).
I'd like to propose that scale_[fill/color]_discrete
gain a new argument, say codes
, that would accept a vector of color codes. In the event codes
is longer than the number of levels to encode, it would effectively be scale_[fill/color]_manual
; otherwise, it would effectively be scale_[fill/color]_hue
. Moreover, I think it would make sense for codes
to default to something sensible like Okabe-Ito.
It seems the implementation for this would be relatively straight-forward (see here for a proof-of-concept). If there's interest in pursuing this idea, I'd be happy to start a PR.