Search code examples
bokeh

Bokeh change properties of individual layers in a nested categorical plot


I have a nested categorical plot with vbars. In my plot, the smallest level label overlap one another depending on the data. I would like to turn that level to visible = False to remove the labels in a python callback. Any ideas how to access the p.xrange or p.xaxis objects to accomplish this?

This is a good example of a nested categorical where I would for example want the year to be non-visible.

https://docs.bokeh.org/en/latest/docs/user_guide/categorical.html#nested-categories


Solution

  • It is not possible to remove labels (except by writing a custom extension ticker) but as of Bokeh 0.12.16, it is possible to rotate all levels of categorical ticks, e.g.

    p.xaxis.major_label_orientation = "vertical"
    p.xaxis.subgroup_label_orientation = "normal"
    p.xaxis.group_label_orientation = 0.8