David D Clark wrote:
> Hi Folks,
> 
> I have an array A=f(x) with a family of curves.  Is there an easy way to
> get a different marker for each line of plot(x,A).

Use itertools.cycle() to make an iterator that goes round-and-round. Use
itertools.izip() to match it up with your data, and perhaps a set of colors, 
too.


import itertools


def marker_cycle():
    """ Return an infinite, cycling iterator over the available marker symbols.

    This is wrapped in a function to make sure that you get a new iterator
    that starts at the beginning every time you request one.
    """
    return itertools.cycle([
        'o','^','v','<','>',
        's','+','x','D','d',
        '1','2','3','4','h',
        'H','p','|','_'])

for kk, m in itertools.izip(range(A.shape[0]), marker_cycle()):
    loglog(f, A[kk], linestyle='-', marker=m, lw=2)


-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth."
  -- Umberto Eco


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to