-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Add an example using CategoricalColorMapper and Legend #5112
Comments
@birdsarah where should this go? Styling Visual Attributes ? |
This example is already in http://bokeh.pydata.org/en/latest/docs/user_guide/annotations.html#legends |
I think this a very nice example, actually. I was looking for CategorialColorMapper and found its usage only here. I think the documentation would benefit from such example. The referenced page (legends) shows only a variant of this and it is not as elegant as the one from @birdsarah |
I agree with the @mficek 's assessment here. This is a useful example of a topic that doesn't seem well covered in docs. |
I also agree with @mficek. The example here uses CategorialColorMapper to bind a categorical variable, instead of explicitly calling out the color in the ColumnDataSource in the user_guide example. I would also add, that in explorative data analysis, we often don't know the number of unique levels in a categorical variable "before" we want to plot it. So an even more powerful example would include 1) Counting the number of unique levels. 2) Picking an appropriate categorical pallet with matching number colors. If the number of levels is, say, greater then the unique colors in the chosen palette, then recycle the colors starting at [0] |
For those who end up here from using old examples or by some mistake of Google - go see the docs: https://bokeh.pydata.org/en/latest/docs/user_guide/categorical.html. This stuff has gotten much easier to use now. |
Still not finding an example in the documentation that explain how to get categorical coloring without specifing a color field. From the documentation it's impossible to guess how to use CategoricalColorMapper. |
@atrabattoni narrative documentation on client side color mapping is here: https://docs.bokeh.org/en/latest/docs/user_guide/basic/data.html#client-side-color-mapping Generally speaking, these days you'd probably use the higher level There are also lots of examples that use Many of these are also in the docs, e.g. especially in the "Bars" section: https://docs.bokeh.org/en/latest/docs/user_guide/basic/bars.html Or if you are asking about legend grouping (it's not really clear at all), then that is documented in two subsections here: https://docs.bokeh.org/en/latest/docs/user_guide/basic/annotations.html#legends Unfortunately, I am not at all sure what "how to get categorical coloring without specifing a color field" means? color mappers are generally always applied to a glyph's various color properties, that is their intended purpose. It's not really clear what it is you are expecting to be able to do. However, I would ask that you migrate that usage question to the Discourse: rather than continuing here. The Discourse is a better place to sort out your usage questions. Please provide more details, e.g. a more thorough description of what you are trying to accomplish and especially a (minimal) complete example code for what you are trying, that is not working the way you expect. |
Thank you for this detailed answer. Indeed I completely misunderstood that In particular, I think that the Annotations section is quite misleading. This example does not seem best practice (creating a color field that is just a mapping of another one). Also I was expecting finding some information in the Categorical plots section. Now that I read it again the solution was hidden in the Heatmaps subsection but this later is partially up to date. Indeed So after I saw several examples of usage of I'll use more the Discourse next time. |
e.g.
The text was updated successfully, but these errors were encountered: