晶须未出现在散景图中

Whisker not showing up in Bokeh plot

我最近有一个家庭作业问题,给了我们一个数据集,并要求我们计算模型分布的一些参数,以及置信区间。我想制作一个带有误差线的快速绘图来显示数据,但我根本无法让 Whisker 显示出来。我使用的是 Bokeh 2.2.1,所以我认为这不是版本问题,Bokeh 文档中的示例晶须代码也可以正常工作。

这是我为情节编写的代码:

from bokeh.io import show
from bokeh.models import ColumnDataSource, Whisker
from bokeh.plotting import figure
from bokeh.transform import factor_cmap

groups= ['Het', 'Wt', 'Mut']
vals = [mle_het[0], mle_wt[0], mle_mut[0]]
upper = [conf_int_het[1][0], conf_int_wt[1][0], conf_int_mut[1][0]]
lower = [conf_int_het[0][0], conf_int_wt[0][0], conf_int_mut[0][0]]

source = ColumnDataSource(data=dict(groups=groups, vals=vals, upper=upper, lower=lower))

p = figure(x_range=groups, plot_height=350, title="Mu MLEs with Error Bars @ 95% Confidence Interval", y_range=(0,40))

p.add_layout(
    Whisker(source=source, base="groups", upper="upper", lower="lower")
)

p.circle(x='groups', y = 'vals', size=15, source=source, legend_group="groups",
       line_color='white', fill_color=factor_cmap('groups', palette=["#962980","#295f96","#29966c"],
                                                  factors=groups))

p.xgrid.grid_line_color = None
p.legend.orientation = "horizontal"
p.legend.location = "top_center"

show(p)

vals、upper 和 lower 列表只是我从代码前面的数据中提取的三个浮点数。

我得到的情节有一个 link,除了错误栏之外,一切都很好。我也没有收到任何错误消息。如果有人知道如何解决它,我将不胜感激!

plot1

这是一个将在 2.3 中修复的错误: https://github.com/bokeh/bokeh/issues/10575