Matplotlib直方图y轴范围

时间:2020-03-16 05:57:24

标签: python matplotlib histogram

我想绘制一个直方图,我将数据集存储为字典;字典的键是hist的x轴,字典的值是y轴。数据集如下所示;但是,我遇到了字典差异巨大的问题。我怎么能把hist中的小值以及轴上的最大范围为何设为3.0,我希望它是120,000还是可以代表字典中的值。代码和历史记录如下enter image description here所示。代码如下所示。预先感谢!

buyCount = dict(buyTemp['time','count'])
buyBins = list(buyCount.keys())


plt.hist(buyCount.values(),bins = buyBins, align = 'left',stacked = True, histtype = 'bar', rwidth = 0.5) #,density = True)
plt.xlabel('Broker Id', fontsize = 14)
plt.ylabel('Frequency', fontsize = 14)
plt.yscale('log')
plt.title('Times for buy activities', fontsize = 14)

enter image description here

0 个答案:

没有答案
相关问题