准备数据
x = [1, 2, 3, 4]
y = [10, 20, 25, 30]
# 2. 创建绘图
fig = plt.figure()
# 3....自定义绘图
ax.plot(x, y, color='lightblue', linewidth=3)
ax.scatter([2, 4, 6],
[5, 15, 25],...fig.add_axes()
ax1 = fig.add_subplot(221) # 行-列-数字
ax3 = fig.add_subplot(212)
fig3, axes = plt.subplots...1, 2])
# 在轴上绘制一条水平线
axes[1, 1].axhline(0.45)
# 在轴上绘制一条垂直线
axes[0, 1].axvline(0.65)
# 绘制填充的多边形
ax.fill...(X, Y, U, V)
数据分布
# 绘制直方图
ax1.hist(y)
# 制作一个箱图
ax3.boxplot(y)
# 制作小提琴图
ax3.violinplot(z)
自定义绘图
颜色,彩条(