On Tue, Feb 15, 2011 at 9:24 AM, Sebastian Busch <webmas...@thamnos.de> wrote:
> Dear list,
>
> if I do a
>
> plot([1,2],[1,2])
> plot([1,2],[1,3])
> plot([1,2],[1,4])
>
> I will get three lines. All have linestyle='-', the colour is changed
> automatically: blue, green, red, ...
>
> Can I change this behaviour to: All have the colour black, and the
> linestyle is changed /automatically/ '-', '--', '-.', ...?

You can use itertools.cycle, that will repeatedly loop over a sequence of items:

import matplotlib.pyplot as pl
from itertools import cycle
styles = cycle(['k-', 'k--', 'k-.'])
plot([1,2], [1,2], styles.next())
plot([1,2], [1,3], styles.next())
plot([1,2], [1,4], styles.next())

Ryan

-- 
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma

------------------------------------------------------------------------------
The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE:
Pinpoint memory and threading errors before they happen.
Find and fix more than 250 security defects in the development cycle.
Locate bottlenecks in serial and parallel code that limit performance.
http://p.sf.net/sfu/intel-dev2devfeb
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to