ggplot2 icon indicating copy to clipboard operation
ggplot2 copied to clipboard

Feature request: improve palette interface

Open teunbrand opened this issue 1 year ago • 0 comments

The current interface for interacting with palettes is by wrapping each one in a scale. I dislike this for the following reasons:

  • It expanded the number of scale functions in ggplot2 beyond modesty (do we really need continuous, discrete and binned variants of every palette?).
  • It encourages developers of palette packages to model their interface after ggplot2's interface.

It is no good reverting the scales we already have, but we may yet prevent wildgrowth of future scale functions. The proposal is to make the palette argument in scales more accessible to users, by for example:

  • Directly expose the palette argument in some scale functions
  • This palette argument would then accept:
    • A function, as it does currently
    • A keyword, like "viridis" or "okabe-ito"
    • A vector of values that can be translated to a function
  • Abstract away the distinction between discrete and continuous palettes.
    • A user shouldn't have to worry about this
    • Auto-translate discrete palettes to continuous ones
    • Auto-translate continuous palettes to discrete ones

teunbrand avatar Aug 27 '24 14:08 teunbrand