首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Bokeh 1.4.0胡须未显示

Bokeh 1.4.0胡须未显示
EN

Stack Overflow用户
提问于 2020-05-13 17:23:43
回答 2查看 110关注 0票数 1

嗨,我在过去的两个月里一直在和Bokeh一起工作,我刚刚发现我无法在我的图中添加胡须(错误条)。他们就是不显眼!有人知道怎么解决这个问题吗?

代码语言:javascript
复制
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)

提前感谢:)

EN

回答 2

Stack Overflow用户

发布于 2020-05-13 17:54:18

您没有提供完整的代码,所以很难说清楚。但它在Bokeh 2.0.2上工作得很好:

代码语言:javascript
复制
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)
票数 0
EN

Stack Overflow用户

发布于 2020-06-09 16:50:47

所以最后我发现了问题:我没有给出正确的值作为基值,但现在一切都好了。无论如何,还是要感谢:)

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/61770862

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档