在常规(低级别)绘图中,可以像这样设置标签方向:
p.xaxis.major_label_orientation = pi/4
根据 http://docs.bokeh.org/en/0.9.3/docs/user_guide/styling.html#tick-label-orientation
我想在 bokeh.charts.Bar 中将 x 轴标签方向设置为“水平”,但找不到执行此操作的方法。
Bokeh 0.9.3。
请您参考如下方法:
bokeh.charts API 已于 2017 年弃用并删除,此时不应将其用于任何用途。
从那时起,Bokeh 在受到良好支持的 bokeh.plotting API 中对分类图和条形图的支持变得非常好。现在可以以标准方式旋转条形图上的轴标签:
from math import pi
from bokeh.plotting import figure, show
types = list("ABCDE")
values = [10, 20, 50, 25, 35]
p = figure(x_range=types, plot_height=250)
p.vbar(x=types, top=values, width=0.9)
p.xaxis.major_label_orientation = pi/4 # standard styling code
show(p)
您可以在 Handling Categorical Data 中找到更多信息和示例用户指南的部分。
