【发布时间】:2021-01-19 16:40:07
【问题描述】:
【问题讨论】:
-
我不确定轴标签,但您可以禁用它们并在条形本身内添加常规文本。
-
@EugenePakhomov 听起来是个不错的解决方案,回答一些示例代码,我会将其标记为正确!
【问题讨论】:
扩展对问题的评论:
from bokeh.io import show
from bokeh.models import ColumnDataSource
from bokeh.plotting import figure
ds = ColumnDataSource(dict(x=[1, 2, 3],
y=['a', 'b', 'c']))
p = figure(y_range=sorted(set(ds.data['y'])))
p.hbar(y='y', height=0.8, left=0, right='x', source=ds)
p.text(y='y', text='y', text_baseline='middle', x=0, x_offset=10, color='white', source=ds)
show(p)
【讨论】: