plotnine icon indicating copy to clipboard operation
plotnine copied to clipboard

using the R ggplot palette

Open tr8dr opened this issue 4 years ago • 1 comments

The default colors and fills used by plotnine are not the same as the R ggplot. I don't consider this a bug, but would like to reproduce the same colors. Is there a scale_colors function that reproduces this?

I have a function that generates the default ggplot color palette for n colors. Would it make sense for me to add a function (class) such as:

scale_color_rcmap(hue=(0.004,1.00399), chroma=0.8, luma=0.6)

where the above settings are the defaults? I have a fork of the project with the following classes (functions):

  • scale_color_rcmap()
  • scale_fill_rcmap()

and the alias scale_colour_rcmap(). If you are OK with the functionality and naming will post as a pull request.

tr8dr avatar Sep 08 '21 15:09 tr8dr

That is great, I once wanted to do it but got comfortable with the status-core. However, the core implementation should be in mizani.

  1. In mizani.palettes called hcl_palette.
  2. Then in plotnine, create scale_color_hcl that uses the hcl_palette. Similar to how scale_color_hue uses hue_pal.

Maybe in the next major version that will become the default discrete colour scale.

has2k1 avatar Sep 09 '21 07:09 has2k1