Matplotlib建立在NumPy库的基础上,为Python提供了一种方便、灵活、高效的绘图方式。...as plt# 绘制多个子图fig, axes = plt.subplots(nrows=2, ncols=2)# 在第一个子图中绘制折线图x1 = [1, 2, 3, 4, 5]y1 = [2, 4..., 6, 8, 10]axes[0, 0].plot(x1, y1)axes[0, 0].set_title("Line Chart 1")# 在第二个子图中绘制散点图x2 = [1, 2, 3, 4,...5]y2 = [1, 3, 5, 7, 9]axes[0, 1].scatter(x2, y2)axes[0, 1].set_title("Scatter Plot 1")# 在第三个子图中绘制柱状图...Chart 1")# 在第四个子图中绘制饼图sizes = [10, 20, 30, 40, 50]axes[1, 1].pie(sizes)# 设置子图布局plt.tight_layout()# 显示图表