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

CategoricalColorMapper ColorBar #5618

Closed
js3711 opened this issue Dec 27, 2016 · 4 comments · Fixed by #10779
Closed

CategoricalColorMapper ColorBar #5618

js3711 opened this issue Dec 27, 2016 · 4 comments · Fixed by #10779

Comments

@js3711
Copy link
Contributor

js3711 commented Dec 27, 2016

I have a use case for CategoricalColorMapper to work with the ColorBar class similar to how LinearColorMapper works

The default behavior would be to display the Categorical names next to the particular color value.

@bryevdv
Copy link
Member

bryevdv commented Dec 27, 2016

@js3711 can you elaborate some? Things that are helpful for feature requests:

  • detailed description of need
  • references to similar examples in other systems
  • API / sample code proposals to consider

@js3711
Copy link
Contributor Author

js3711 commented Dec 28, 2016

@bryevdv thank you, I should have been more clear in my previous post.

It is nice how the ColorBar class works with a LinearColorMapper:

mapper = bkmap.LinearColorMapper(palette=colors, low=min_val, high=max_val)
color_bar = ColorBar(color_mapper=mapper, ticker=FixedTicker(ticks=ticks), 
                     label_standoff=12, location=(0,0))
plot.add_layout(color_bar,'right')

It would be nice if the ColorBar class would work the same with a CategoricalColorMapper:

mapper = bkmap.CategoricalColorMapper(factors=categories, palette=colors)
color_bar = ColorBar(color_mapper=mapper, label_standoff=12, location=(0,0))

Extra nice if the ColorBar class automatically detected how the factors were mapped to colors and applied tick marks like so:
image

@bryevdv
Copy link
Member

bryevdv commented Dec 28, 2016

@js3711 Thanks for the additional information. I agree this would be a useful addition. There is some planned work to improve how categorically are handled generally in Bokeh, and it probably makes sense to get that work out of the way first.

That said, I do think that "categorical-like" labels on colorbars are currently accomplishable using custom tick formatters.

ping @birdsarah for FYI and any thoughts

@bryevdv
Copy link
Member

bryevdv commented Aug 25, 2020

I'm going to unmark this as GFI because I expect it might actually be fairly involved. Also adding to 2.3 because I think it is fairly overdue.

@philippjfr philippjfr modified the milestones: 2.3, next Nov 18, 2020
@mattpap mattpap modified the milestones: next, 2.3 Dec 20, 2020
@mattpap mattpap added this to Triage in Layout in ColorBar and Legend annotations via automation Dec 20, 2020
Layout in ColorBar and Legend annotations automation moved this from Triage to Done Jan 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

4 participants