擅长:python、mysql、java
<p>两个样本的直方图的简单示例可能会有所帮助:</p>
<pre class="lang-py prettyprint-override"><code>import numpy as np
import matplotlib.pyplot as plt
# Fixing random state for reproducibility
np.random.seed(19680801)
mu, sigma = 100, 15
x1 = mu + sigma * np.random.randn(10000)
x2 = (mu + sigma * np.random.randn(10000))/2
# the histogram of the data
n, bins, patches = plt.hist([x1,x2], 50, density=True, alpha=0.75)
plt.xlabel('Smarts')
plt.ylabel('Probability')
plt.title('Histogram of IQ')
plt.text(60, .025, r'$\mu=100,\ \sigma=15$')
plt.xlim(40, 160)
plt.ylim(0, 0.03)
plt.grid(True)
plt.show()
</code></pre>
<p>有关如何使用<code>matplotlib</code>的更多示例,请参见<a href="https://matplotlib.org/3.1.1/gallery/index.html" rel="nofollow noreferrer">https://matplotlib.org/3.1.1/gallery/index.html</a></p>
<p>您要求的输出似乎不太常见,因为可能会与堆叠图混淆</p>