【发布时间】:2014-06-11 03:52:44
【问题描述】:
我想使用 matplotlib 绘制条形图或直方图。我不想要堆叠条形图,而是两个数据列表的叠加条形图,例如我有以下两个数据列表:
一些代码开头:
import matplotlib.pyplot as plt
from numpy.random import normal, uniform
highPower = [1184.53,1523.48,1521.05,1517.88,1519.88,1414.98,1419.34,
1415.13,1182.70,1165.17]
lowPower = [1000.95,1233.37, 1198.97,1198.01,1214.29,1130.86,1138.70,
1104.12,1012.95,1000.36]
plt.hist(highPower, bins=10, histtype='stepfilled', normed=True,
color='b', label='Max Power in mW')
plt.hist(lowPower, bins=10, histtype='stepfilled', normed=True,
color='r', alpha=0.5, label='Min Power in mW')
我想将这两个列表与两个列表中的值的数量进行对比,以便我能够看到每次读数的变化。
【问题讨论】:
-
是的,我将其发布在问题的编辑中
-
看看
numpy.cumsum()和pyplot.hist()... -
pyplot.hist() 我该如何使用它?
-
@Ffisegydd 你能提供什么帮助吗?
标签: python numpy matplotlib plot histogram