我想用matplotlib绘制直方图。我想知道怎样才能设置range (<9.0,9.0-10.0,11.0-12.0,12.0-13.0.. max element in an array) of bins。<9.0表示小于0.9的元素
我使用了数组中最小和最大的值:
plt.hist(results, bins=np.arange(np.amin(results),np.amax(results),0.1))如有任何提示,我将不胜感激
发布于 2017-05-11 15:32:28
提供给bins的列表或数组包含直方图箱的边缘。因此,您可以创建一个范围从results中的最小值到9.0的二进制。
bins = [np.min(results)] + range(9, np.max(results), 1)
plt.hist(results, bins=bins)https://stackoverflow.com/questions/43883704
复制相似问题