Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Dec 9th, 2012  |  syntax: Python  |  size: 0.42 KB  |  views: 75  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. from random import random
  2. import matplotlib.pyplot as plt
  3.  
  4. mylist = [[random() for _ in range(10)] for _ in range(10)]
  5.  
  6. fig = plt.figure()
  7. ax = fig.add_axes([0.1, 0.1, 0.6, 0.8])
  8. for i, l in enumerate(mylist):
  9.     ax.plot(range(10), l, label='label_%d' % i)
  10.  
  11. legenda = ax.legend(loc=2, borderaxespad=0., bbox_to_anchor=(1.02, 1.0))
  12. plt.savefig('plot.png', bbox_extra_artists=[legenda], bbox_inches='tight')
  13. plt.show()
clone this paste RAW Paste Data