问题描述
我正在尝试在Bokeh的多分类图中旋转主轴和副轴(类似于对主要刻度标签,并在matplotlib中完成.当具有多个类别时,它们的标签/文本经常会被涂抹在一起.
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.
从 Bokeh分类文档中汲取灵感使用Bokehs vbar
功能对数据进行搜索,结果类似于
Taking some inspiration from the Bokeh documentation on Categorical Data the result, using Bokehs vbar
functionality, would look something like
可以使用
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!
推荐答案
更新
此功能是在散景0.12.16
中添加的,您现在可以执行以下操作:
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
在Bokeh 0.12.13中是不可能的,除第一个水平以外的其他水平的标签方向始终为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.
这篇关于旋转次要刻度标签以进行分类散景图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!