【Matplotlib】pyplot的高级功能添加图例与注释设置图形标题及坐标轴添加网格线绘制多个子图Axes与Subplot的区别
添加图例与注释给图形添加图例代码import numpy as npimport matplotlib.pyplot as pltnbSamples = 128x = np.linspace(-np.pi, np.pi, nbSamples)y1 = np.sin(x)y2 = np.cos(x)plt.plot(x, y1, color='g', linewidth=4, linestyle='--', label=r'$y = sin(x)$')plt.plot(x, y2, '