【问题标题】:Rotating minor tick labels for categorical Bokeh plot旋转分类散景图的次要刻度标签
【发布时间】:2018-07-15 20:08:12
【问题描述】:

我正在尝试在 Bokeh 的多类别图中旋转长轴 - 和短轴(类似于对主要刻度标签 here 和在 matplotlib here 中完成的操作) . 当有多个类别时,它们的标签/文本经常被涂抹在一起。

Bokeh documentation on Categorical Data 的结果中汲取灵感,使用散景vbar 功能,看起来像

可以使用设置主轴

p.xaxis.major_label_orientation = pi/4

但我找不到任何方法可以为未成年人实际做同样的事情......

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

如果有任何想法,我们将不胜感激!

【问题讨论】:

  • 每个 seaborn 图都是 matplotlib 图,因此 this solution 连同链接的 matplotlib 刻度旋转将直接适用于 seaborn。在任何情况下,您都需要决定是否需要 matplotlib 或散景解决方案。如果您两者都需要,请分别提出两个问题。
  • @ImportanceOfBeingErnest 更改为散景。谢谢。

标签: python bokeh


【解决方案1】:

更新

此功能已添加到 Bokeh 0.12.16,您现在可以这样做:

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

如果您需要此功能,欢迎您使用功能请求创建 GitHub 问题。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-10-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多