Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Apr 24th, 2012  |  syntax: None  |  size: 0.34 KB  |  hits: 14  |  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. how do I have matplotlib change line markers automatically? [closed]
  2. import matplotlib.pyplot as plt
  3.  
  4. f = plt.figure(1); f.clf()
  5. ax = f.add_subplot(111)
  6. ax.plot([1,2,3,4,5])
  7. ax.plot([5,4,3,2,1])
  8. ax.plot([2,3,2,3,2])
  9.  
  10. import itertools
  11. for l, ms in zip(ax.lines, itertools.cycle('>^+*')):
  12.     l.set_marker(ms)
  13.     l.set_color('black')
  14.  
  15. plt.show()