Matplotlib 在双直方图上为每个直方图绘制两条高斯线

Matplotlib 在双直方图上为每个直方图绘制两条高斯线,matplotlib,Matplotlib,我正在同一子地块上绘制两个直方图: n,x,_ = ax2.hist([months, months1], bins = bins, density = 'True') 我想在每个直方图上画两条高斯线: density = stats.gaussian_kde(months) density1 = stats.gaussian_kde(months1) ax2.plot(x[0], density(x[0)]) ax2.plot(x[1], density1(x[1])) 但返回的x不是数组

我正在同一子地块上绘制两个直方图:

n,x,_ = ax2.hist([months, months1], bins = bins, density = 'True')
我想在每个直方图上画两条高斯线:

density = stats.gaussian_kde(months)
density1 = stats.gaussian_kde(months1)
ax2.plot(x[0], density(x[0)])
ax2.plot(x[1], density1(x[1]))
但返回的x不是数组列表。它只是一个数组。 怎样才能做到呢


谢谢。

这是相同的数组,所以只需使用
x
本身。正确!非常感谢。