Python-Matplotlib 6 直方圖


Python-Matplotlib 5 直方圖

 

Good  http://blog.csdn.net/u013571243/article/details/48998619

 

 

 

 

Example 1 

import numpy as np
import matplotlib.pyplot as plt

mu = 100 # mean of distribution
sigma = 20 # standard deviation of distribution
x = mu + sigma * np.random.randn(2000)

plt.hist(x, bins=10 , color='m' ,)
# p1 : normal = True 
# p2 : ignore normal = True 
plt.show()

 

P1

  

P2

 

Example 2 :

import numpy as np
import matplotlib.pyplot as plt

x = np.random.randn(1000) + 2
y = np.random.rand(1000) + 3
plt.hist2d(x,y ,bins=400)
plt.show()

 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM