Python matplotlib 画直方图

histogram 

[ˈhɪstəɡræm]  n.(统计学的) 直方图,矩形图;
 

import numpy as np
import math
from matplotlib import pyplot as plt
from pandas import Series, DataFrame

fig, ax=plt.subplots()
x = np.arange(0, 101, 1)  
y = nums
plt.plot(x, y)

ax.set_title('Train Set')
plt.xlabel('Age')
plt.ylabel('count')
#plt.xlim(0,100) #设置x轴分布范围

plt.show()

猜你喜欢

转载自blog.csdn.net/tony2278/article/details/103181065