from random import random import matplotlib.pyplot as plt mylist = [[random() for _ in range(10)] for _ in range(10)] fig = plt.figure() ax = fig.add_axes([0.1, 0.1, 0.6, 0.8]) for i, l in enumerate(mylist): ax.plot(range(10), l, label='label_%d' % i) legenda = ax.legend(loc=2, borderaxespad=0., bbox_to_anchor=(1.02, 1.0)) plt.savefig('plot.png', bbox_extra_artists=[legenda], bbox_inches='tight') plt.show()