Skip to content
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

Allow using explicit colormapping on non-categorical data #3071

Merged
merged 4 commits into from
Oct 10, 2018

Conversation

philippjfr
Copy link
Member

This PR allows providing an explicit colormapping for non-categorical data.

@philippjfr philippjfr added tag: backend: bokeh type: enhancement Minor feature or improvement to an existing feature labels Oct 10, 2018
@@ -1189,6 +1192,11 @@ def _get_color_data(self, element, ranges, style, name='color', factors=None, co

mapper = self._get_colormapper(cdim, element, ranges, style,
factors, colors)
if not factors and isinstance(mapper, CategoricalColorMapper):
field += '_str'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks a little hackish?

Copy link
Member Author

@philippjfr philippjfr Oct 10, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it? In what way? I've used this approach throughout.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be clearer, what's your suggestion for not overriding the original column and making it clear the column has been "categorized" by casting values to strings?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be worth coming up with a longer string to make clashes with user columns more unlikely.

@jlstevens
Copy link
Contributor

Looks good! I'll merge when the tests pass.

@jlstevens
Copy link
Contributor

Tests have passed now. Merging.

@jlstevens jlstevens merged commit d91c86f into master Oct 10, 2018
@philippjfr philippjfr added this to the v1.10.8 milestone Oct 25, 2018
@philippjfr philippjfr deleted the explicit_categorical branch November 12, 2018 18:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tag: backend: bokeh type: enhancement Minor feature or improvement to an existing feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants