美文网首页
Matplotlib: barplot

Matplotlib: barplot

作者: LET149 | 来源:发表于2023-08-21 09:06 被阅读0次
import matplotlib.pyplot as plt
import numpy as np
plt.style.use('_mpl-gallery')

# make data:
x = 0.5 + np.arange(8)
y = [4.8, 5.5, 3.5, 4.6, 6.5, 6.6, 2.6, 3.0]

# plot
fig, ax = plt.subplots()

ax.bar(x, y, width=1, edgecolor="white", linewidth=0.7)

ax.set(xlim=(0, 8), xticks=np.arange(1, 8),
       ylim=(0, 8), yticks=np.arange(1, 8))

plt.show()
image.png

2. 参数

相关文章

网友评论

      本文标题:Matplotlib: barplot

      本文链接:https://www.haomeiwen.com/subject/xtplpdtx.html