Rotating minor tick labels for categorical Bokeh plot

≯℡__Kan透↙ 提交于 2019-12-02 00:50:44

问题


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

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!


回答1:


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.



来源:https://stackoverflow.com/questions/48631546/rotating-minor-tick-labels-for-categorical-bokeh-plot

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!