Brian Blais <bblais@...1129...> writes:
Is there a way to specify the default order of line colors and
styles, for plot commands given in sequence
I don't think there is built-in support for this. See e.g.
http://thread.gmane.org/gmane.comp.python.matplotlib.general/5708
for some previous discussion and suggestions.
···
--
Jouni K. Sepp�nen
It's probably worth mentioning that the cyclers John mentions are
trivial to write using itertools:
colorcycler = itertools.cycle(['blue','green','red','magenta','cyan'])
linecycler = itertools.cycle([ '-','--', '-.' , ':' ])
n = itertools.count()
y = array([1,2,3])
Then, try:
for i in range(10):
plot(y+n.next(),color=c.next(),linestyle=linecycler.next())
···
On 2/23/07, Jouni K. Seppänen <jks@...397...> wrote:
Brian Blais <bblais@...1129...> writes:
> Is there a way to specify the default order of line colors and
> styles, for plot commands given in sequence
I don't think there is built-in support for this. See e.g.
http://thread.gmane.org/gmane.comp.python.matplotlib.general/5708
for some previous discussion and suggestions.
Sorry, tab put me in the 'send' button in gmail too early... I meant:
import itertools
colorcycler = itertools.cycle(['blue','green','red','magenta','cyan']).next
linecycler = itertools.cycle([ '-','--', '-.' , ':' ]).next
n = itertools.count().next
y = array([1,2,3])
for i in range(10):
plot(y+n(),color=colorcycler(),linestyle=linecycler())
Cheers,
f
···
On 2/23/07, Fernando Perez <fperez.net@...287...> wrote:
On 2/23/07, Jouni K. Seppänen <jks@...397...> wrote:
> Brian Blais <bblais@...1129...> writes:
>
> > Is there a way to specify the default order of line colors and
> > styles, for plot commands given in sequence
>
> I don't think there is built-in support for this. See e.g.
> http://thread.gmane.org/gmane.comp.python.matplotlib.general/5708
> for some previous discussion and suggestions.
It's probably worth mentioning that the cyclers John mentions are
trivial to write using itertools: