Often when you legend is too large, it is convenient to put it off to the side. Here's how...
from matplotlib import pyplot as plt
plt.plot(a,b, label="legend label")
plt.legend(loc='center left', bbox_to_anchor=(1, 0.5),prop={'size':10})
An example here: