How to use matplotlib to draw histogram in Python
How to use matplotlib to draw histogram in Python. In view of this problem, this article introduces the corresponding analysis and solution in detail, hoping to help more partners who want to solve this problem to find a more simple and feasible method.
Matplotlib Common Chart drawing-histogram
Series.hist (): single histogram
# multiple histograms df = pd.DataFrame ({'fags: np.random.randn (1000) + 1,' iTunes: np.random.randn (1000), 'np.random.randn: np.random.randn (1000)-1,' hints: np.random.randn (1000)-2}, columns= ['fags,' iTunes, 'Sigma']) df.hist (bins=50)
Dataframe.hist (): multiple histograms
# multiple histograms df = pd.DataFrame ({'fags: np.random.randn (1000) + 1,' iTunes: np.random.randn (1000), 'np.random.randn: np.random.randn (1000)-1,' hints: np.random.randn (1000)-2}, columns= ['fags,' iTunes, 'Sigma']) df.hist (bins=50)
Plt.plot.hist (stacked=True) stacking histogram
# stacked histogram stacked=Truedf = pd.DataFrame ({'fags: np.random.randn (1000) + 1,' iTunes: np.random.randn (1000), 'np.random.randn: np.random.randn (1000)-1,' hacks: np.random.randn (1000)-2}, columns= ['fags,' iTunes, 'slots']) df.plot.hist (stacked=True, bins=20,colormap='Blues_r' Alpha=0.5,grid=True) the answer to the question about how to draw a histogram with matplotlib in Python is shared here. I hope the above content can help you to a certain extent, if you still have a lot of doubts to be solved, you can follow the industry information channel to learn more related knowledge.