plt.plot([1, 2, 3], label='Inline label')
plt.legend(loc=1, prop={'size': 16})
plt.legend(title="My Title", fontsize=10, title_fontsize=15)
import matplotlib.pyplot as plt
import numpy as np
x = np.linspace(0, 10, 100)
fig, ax = plt.subplots()
for i in range(1, 6):
ax.plot(x, i*x + x, label='$y={i}x + {i}$'.format(i=i))
ax.legend(loc='upper left')
plt.show()
plot.legend(loc=2, prop={'size': 6})
plt.legend(fontsize=20) # using a size in points
plt.legend(fontsize="x-large") # using a named size