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