1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| import matplotlib.pyplot as plt
plt.subplot(211) plt.plot([1, 2, 3], label="test1") plt.plot([3, 2, 1], label="test2")
plt.legend(bbox_to_anchor=(0., 1.02, 1., .102), loc='lower left', ncol=2, mode="expand", borderaxespad=0.)
plt.subplot(223) plt.plot([1, 2, 3], label="test1") plt.plot([3, 2, 1], label="test2")
plt.legend(bbox_to_anchor=(1.05, 1), loc='upper left', borderaxespad=0.)
plt.show()
|