matplotlib直方图

import matplotlib.pyplot as plt
import matplotlib as mpl
from matplotlib.font_manager import FontProperties
font = FontProperties(fname='/System/Library/Fonts/STHeiti Light.ttc', size=16)

heights = [168,175,167,189,188,160,187,156,157,178]
bins =range(150,190,5)
print(list(bins))
plt.title("身高",fontproperties=font)
plt.hist(heights,bins=bins,color='fuchsia',alpha=0.5) # alpha 透明度 0 完全透明 color颜色 bins表示区间
plt.show()

 

 

posted @ 2020-03-15 19:08  brady-wang  阅读(203)  评论(0编辑  收藏  举报