python数据可视化学习-直方图

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_31390999/article/details/82828834
import numpy as np
import matplotlib.pyplot as plt
mu = 1000
sigma = 10
x = mu + sigma*np.random.randn(2000)
plt.hist(x,bins=10,color='red',normed=True)
plt.show()

但是图里面没有边框

import numpy as np
import matplotlib.pyplot as plt
mu = 1000
sigma = 10
x = mu + sigma*np.random.randn(2000)
plt.hist(x,bins=10,color='red',normed=True,edgecolor='k')
plt.show()

import numpy as np
import matplotlib.pyplot as plt
x = np.random.randn(1000)+2
y = np.random.randn(1000)+3
plt.hist2d(x,y,bins=40)
plt.show()

猜你喜欢

转载自blog.csdn.net/qq_31390999/article/details/82828834