【问题标题】:Plotting error bars for factorplot in Seaborn without bootstrapping在 Seaborn 中为 factorplot 绘制误差线,无需引导
【发布时间】:2016-11-17 23:41:37
【问题描述】:

在 Seaborn 中使用 factorplot 时,使用自举计算估计器的置信区间。有没有办法指定提取间隔的替代方法?例如,如果我的数据是 MCMC 模拟输出或者它们本身是引导样本,那么引导没有意义——我只想为区间使用适当的分位数。

【问题讨论】:

    标签: python plot seaborn


    【解决方案1】:

    同样的问题。这是我在seaborn.pointplot 的情况下的短期解决方案:

    如果相关的seaborn代码是:

    seaborn.pointplot(x="value", y="parameters", data=dfm, ci=50, join=False)
    

    如果我们希望 50 是没有引导的区间,那么这段 plotnine 代码实际上做了同样的事情:

    g = plotnine.ggplot(data=dfm) + plotnine.geom_pointrange(
                mapping=plotnine.aes(x="parameters",y="value"),
                stat = "summary",
                fun_ymin=lambda x: np.percentile(x, 25),
                fun_ymax=lambda x: np.percentile(x, 75),
                fun_y=np.mean,
            ) + plotnine.coord_flip()
    

    无需操作数据框。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-09-12
      • 1970-01-01
      • 2018-08-05
      • 2018-01-15
      • 2017-01-02
      • 2013-03-15
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多