【问题标题】:Whisker not showing up in Bokeh plot胡须没有出现在散景图中
【发布时间】:2020-12-04 02:21:08
【问题描述】:

我最近遇到了一个作业问题,我们得到了一个数据集,并要求我们计算模型分布的一些参数,以及置信区间。我想用误差线快速绘制数据以显示数据,但我根本无法让 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 列表只是我从代码前面的数据中提取的三个浮点数。

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

plot1

【问题讨论】:

    标签: python bokeh boxplot


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-10-07
      • 2021-12-28
      • 2022-08-11
      • 1970-01-01
      • 2014-03-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多