嗨,我在过去的两个月里一直在和Bokeh一起工作,我刚刚发现我无法在我的图中添加胡须(错误条)。他们就是不显眼!有人知道怎么解决这个问题吗?
myplot = figure(
x_range=my_x_range,
plot_width=width,
plot_height=height,
title=titre,
y_axis_label=value,
tools="save,wheel_zoom,reset,hover",
tooltips=TOOLTIPS
)
for val in stackers:
base_listoflists = list(mean_df_unstack[val])
upper_listoflists = list(upper_df[val])
lower_listoflists = list(lower_df[val])
whisker_dico = dict(
base = base_listoflists,
upper = upper_listoflists,
lower = lower_listoflists)
source = bk.models.ColumnDataSource(data=whisker_dico)
print(source)
mywhisker = bk.models.Whisker(
source = source,
base = "base",
upper = "upper",
lower = "lower",
level="annotation")
myplot.add_layout(mywhisker)
#Plot the love
myplot.vbar_stack(stackers,
x='ID',
source=meanplotdic,
width=0.9,
color=cc.glasbey_dark[:len(stackers)]
)
myplot.xaxis.major_label_orientation = math.pi/4
show(myplot)提前感谢:)
发布于 2020-05-13 17:54:18
您没有提供完整的代码,所以很难说清楚。但它在Bokeh 2.0.2上工作得很好:
from bokeh.io import show
from bokeh.models import ColumnDataSource, Whisker
from bokeh.plotting import figure
ds = ColumnDataSource(dict(c=['a', 'b', 'c'],
bottom=[-1, 0, 1], lower=[-2, -0.5, 0.2],
top=[3, 4, 2], upper=[4, 6, 3]))
p = figure(x_range=['a', 'b', 'c'], y_range=(-3, 7))
p.vbar('c', 0.5, 'top', 'bottom', source=ds)
p.add_layout(Whisker(upper='upper', lower='lower', base='c', source=ds))
show(p)发布于 2020-06-09 16:50:47
所以最后我发现了问题:我没有给出正确的值作为基值,但现在一切都好了。无论如何,还是要感谢:)
https://stackoverflow.com/questions/61770862
复制相似问题