【问题标题】:access to bin counts in seaborn distplot访问 seaborn distplot 中的 bin 计数
【发布时间】:2015-10-22 00:25:36
【问题描述】:

在 pyplot 的 hist() 函数中,我们可以访问直方图 bin 的值(通过返回 n);是否可以从Seaborn's distplot 访问相同的信息? Seaborn 只返回一个轴对象。

最后,我想在直方图的顶部并列绘制一个线图,用于汇总 bin 中的计数。

【问题讨论】:

  • ax.hist(yourdata) ?
  • 或者更好的是使用numpy.histogram
  • 是的,我在看 numpy.histogram,这是 seaborn 在后端调用的内容吗?
  • seaborn 只是使用 matplotlib 直方图函数,但我认为这可能在幕后使用 numpy(或者无论如何 numpy 会给出相同的答案)。

标签: python matplotlib histogram seaborn


【解决方案1】:

为了完整起见,numpy.histogram 是我要找的!

【讨论】:

  • 您能否详细说明您是如何从 numpy.histogram 中获得 bin 数量的?
  • @Plasma,只使用 np.histogram(data)?给你两个向量
猜你喜欢
  • 2017-10-12
  • 1970-01-01
  • 1970-01-01
  • 2018-04-19
  • 2020-12-10
  • 2020-06-16
  • 1970-01-01
  • 2015-05-25
  • 2016-08-05
相关资源
最近更新 更多