散景1.4.0晶须未显示

问题描述 投票:0回答:1

嗨,我过去两个月一直在与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)

'''

提前感谢:)

python annotations bokeh
1个回答
0
投票

您没有提供完整的代码,因此很难说清楚什么。但这对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)
© www.soinside.com 2019 - 2024. All rights reserved.