在常规(低级)绘图中,可以像这样设置标签方向:
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中找到更多信息和示例。用户指南的部分。
关于python - xaxis.major_label_orientation 用于 Bokeh 条,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39298411/