gussilago
gussilago

Reputation: 932

Rotating minor tick labels for categorical Bokeh plot

I am trying to rotate the major- and the minor axis within a multi-categorical plot in Bokeh (similar to what is done for major tick labels here and done within matplotlib here. When having several categories, their labels/text often get smeared together.

Taking some inspiration from the Bokeh documentation on Categorical Data the result, using Bokehs vbar functionality, would look something like

Plot with rotated minor *and* major x-axis

The major axis can be set using

p.xaxis.major_label_orientation = pi/4

Yet I can't find any way of actually doing the same for the minors...

? p.xaxis.minor[0]_label_orientation = pi/4 ?
? p.xaxis.minor[1]_label_orientation = pi/3 ?
...

Any thoughts out there would be very much appreciated!

Upvotes: 5

Views: 1799

Answers (1)

Eugene Pakhomov
Eugene Pakhomov

Reputation: 10727

UPDATE

This capability was added in Bokeh 0.12.16, you can now do:

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

It's not possible in Bokeh 0.12.13, the orientation of labels for levels other than the first one is always parallel: https://github.com/bokeh/bokeh/blob/0.12.13/bokehjs/src/coffee/models/axes/categorical_axis.coffee#L89-L92

You're welcome to create a GitHub issue with a feature request if you need this functionality.

Upvotes: 4

Related Questions