-
-
Notifications
You must be signed in to change notification settings - Fork 404
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Define Palettes and Cycles from backend specific colormaps/palettes #1605
Conversation
holoviews/plotting/bokeh/__init__.py
Outdated
@@ -106,6 +107,17 @@ | |||
Cycle.default_cycles['default_colors'] = ['#30a2da', '#fc4f30', '#e5ae38', | |||
'#6d904f', '#8b8b8b'] | |||
|
|||
# Define Palettes and Cycles from bokeh palettees |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo: palettees
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Palettees?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah I'm blind.
holoviews/plotting/bokeh/__init__.py
Outdated
@@ -106,6 +107,17 @@ | |||
Cycle.default_cycles['default_colors'] = ['#30a2da', '#fc4f30', '#e5ae38', | |||
'#6d904f', '#8b8b8b'] | |||
|
|||
# Define Palettes and Cycles from bokeh palettees | |||
def colormap_generator(palette): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason not to just return a lambda?
@philippjfr Other than the two comments I made, looks good. I would like to merge this ASAP as this would help me for some of the examples I am currently working on... |
Agreed. I think it might be worth filing an issue to discuss palettes but I don't think that discussion should hold up this PR. |
de2ca88
to
6979846
Compare
Looks good. Merge when the tests pass? |
Yes, ready, here's the set of categorical Cycles that are available for both matplotlib and bokeh:
|
Wonder where we should record that information about what is consistent and available... |
Maybe colormaps/palettes should have a user guide? |
Seems sensible, or fold it into a more general user guide about plotting in addition to the backend specific guides we already have planned. |
Tests are green. Merging. |
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Since we no longer import the matplotlib backend the list of Palettes are only populated if that particular backend is imported. This PR does several things:
Cycle(values=['red', 'green', 'blue'])
orCycle(key='default_colors')
now you can doCycle(['red', 'green', 'blue'])
orCycle('default_colors')
.Set1-3
,Dark2
and a few others to be there.The behavior of
Palette
has always been a bit odd and we should probably discuss/address that for 2.0, since it samples the provided function like a colormap and therefore does not cycle. I think that distinction still makes sense as cycling is what Cycle is for but we need to document this at some point. For the time being this is 1) completely backward compatible, 2) allows using categorical colormaps as Cycles and 3) ensures that at least a subset of categorical colormaps/palettes are available for both matplotlib and bokeh.