5

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!

gussilago
  • 922
  • 3
  • 12
  • 27
  • Every seaborn plot is a matplotlib plot, hence [this solution](https://stackoverflow.com/questions/19184484/how-to-add-group-labels-for-bar-charts-in-matplotlib) together with the linked matplotlib tick rotation would directly be applicable to seaborn. In any case, you need to decide if you want a matplotlib or a bokeh solution. In case you want both, ask two separate questions. – ImportanceOfBeingErnest Feb 06 '18 at 14:57
  • @ImportanceOfBeingErnest Changed to Bokeh. Thanks. – gussilago Feb 06 '18 at 15:43

1 Answers1

4

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.

Eugene Pakhomov
  • 9,309
  • 3
  • 27
  • 53