基本概念
实例:
from random import randint
import matplotlib.pyplot as plt
arr = [randint(0, 100) for n in range(100)] # 100个随机数
plt.hist(
x=arr,
bins=20, # 分成20个柱子
rwidth=0.8 # 每个柱子的宽度为0.8倍
)
plt.show()1. 效果

from random import randint
import matplotlib.pyplot as plt
arr = [randint(0, 100) for n in range(100)] # 100个随机数
plt.hist(
x=arr,
bins=20, # 分成20个柱子
rwidth=0.8 # 每个柱子的宽度为0.8倍
)
plt.show()