human
How to change legend size with matplotlib.pyplot
assistant
Here is some code to change legend size to 'x-small' in upper-left location

pyplot.legend(loc=2, fontsize='x-small')

#Warning: this code generation is experimental. Please inspect the code for any bugs before executing.