Well, pylab does choose: it varies color and not the dash
pattern in order to have distinct lines.
I think what you are wanting is something like the
following: have pylab/pyplot cycle automatically through
a set of preset Line2D property combinations, when an axes
plots multiple lines.
I think the answer is: this is not available in the
form you want. (Indeed, it is hard for me to imagine
agreement on "nice" choices for multiple properties.)
Of course you can do something like this::
from itertools import cycle
mystyles = ['r+-', 'b.--', 'go-.'] #etc
ax1styles = cycle( mystyles )
for x,y in data:
ax1.plot(x, y, ax1styles.next())
Cheers,
Alan Isaac
···
On Tue, 19 Feb 2008, Neal Becker apparently wrote:
IIUC, in order to have each line with distinct line style, I have to
explicitly set the line style. I want pylab to just choose them, just as
it does for colors.
You can also cycle through the list matplotlib uses
import matplotlib.lines as lines
# filled markers
fmarkers = lines.Line2D.filled_markers
# all markers
markers = lines.Line2D.markers.keys()
but this is not ideal, since lines.Line2D.markers is a dictionary and
the keys will come back un-ordered. Noone has every asked for
auto-marker cycling before, but it might be a good idea and wouldn't
be too hard to add.
JDH
···
On Feb 19, 2008 9:13 AM, Alan G Isaac <aisaac@...310...> wrote:
Of course you can do something like this::
from itertools import cycle
mystyles = ['r+-', 'b.--', 'go-.'] #etc
ax1styles = cycle( mystyles )
Just an idea: Maybe you could also auto cycle between dash types if only the colour and not the dash type is specified in a plot command. The gnuplot default would be one model, or the predefined patterns in CorelDraw or Inkscape etc. Personally I don't see this as a high priority though.
Gary R.