# -*- encoding: utf-8 -*-
# @File : hist.py
# @Author: Mr. Luo
# @Date: 2021/11/8 13:32
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
'''
在x轴上绘制定量数据的分布特征
'''
'''
x:在x轴上绘制箱体的定量数据输入值
'''
# 中文字符显示
mpl.rcParams["font.sans-serif"] = ["SimHei"]
mpl.rcParams["axes.unicode_minus"] = False
x = np.random.randint(0, 10, 100)
bins = range(0, 11, 1)
plt.hist(x, bins=bins, color="r", histtype="bar", rwidth=2, alpha=0.7)
plt.xlabel("编号")
plt.ylabel("数量")
plt.show()
运行效果:



