1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| import matplotlib.pyplot as plt
fig, ax = plt.subplots()
line1, = ax.plot([1, 2, 3], label="Line 1", linestyle='--') line2, = ax.plot([3, 2, 1], label="Line 2", linewidth=4)
first_legend = ax.legend(handles=[line1], loc='upper right')
ax.add_artist(first_legend)
ax.legend(handles=[line2], loc='lower right')
plt.show()
|