You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Right now, there's a barrier for me to use palettable directly because I have to remember to include the number of colors I want for each colormap when I do the import, and I don't always know where I want to look for the palette I want. Could there be a palettable.make_palette("palettename", n_colors=8) - type interface?
The text was updated successfully, but these errors were encountered:
Hi, thanks for the suggestion! This kind of exists because almost every module has a get_map function (not called get_palette for historical reasons), but the API varies per-module and it's not documented. For example:
In [6]: palettable.wesanderson.get_map('Zissou')
Out[6]: <palettable.wesanderson.wesanderson.WesAndersonMap at 0x103222b38>
In [8]: palettable.colorbrewer.get_map('Blues', 'sequential', 5)
Out[8]: <palettable.colorbrewer.colorbrewer.BrewerMap at 0x109d034a8>
In [12]: palettable.cmocean.sequential.get_map('Turbid_200')
Out[12]: <palettable.cmocean.cmoceanpalette.CmoceanMap at 0x109d27358>
In [13]: palettable.matplotlib.get_map('Viridis_20')
Out[13]: <palettable.matplotlib.matplotlib.MatplotlibMap at 0x109d30128>
One of the challenges with implementing this more generally is that not every palette supports an arbitrary number of colors (really none of them do, but some do up to an upper limit). In particular, qualitative palettes are available for whatever colors are defined and no more. All the colorbrewer palettes max out at 10-12 defined colors, though sequential and diverging ones would probably support interpolation.
All that said, I think is technically possible but it'd require a lot of runtime validation and its usability would hinge on giving the user useful feedback when they ask for something that's not possible to provide. With that in mind, improving discoverability in some other way might be a better use of time. Maybe improvements to the docs or standardizing the get_map function?
Right now, there's a barrier for me to use
palettable
directly because I have to remember to include the number of colors I want for each colormap when I do the import, and I don't always know where I want to look for the palette I want. Could there be apalettable.make_palette("palettename", n_colors=8)
- type interface?The text was updated successfully, but these errors were encountered: