grey scale line plots

I need a figure containing color line plots to
be changed to grayscale, cycling through line
styles instead of colors. How?

Thanks,
Alan Isaac

PSI suppose I searched the web ineffectively on this,
but I did try.

Here's a skeleton, for a series of lines that get darker and more solid (from past to present, as I use it):

from itertools import cycle

grey_linestyles = cycle(map(lambda tu: dict(zip(('color','dashes'),tu)),(('0.5',(4,1,1,1)),('0.4',(2,1)),('0.3',(5,1,2,1)),('0.2',(4,1)),('0.1',(6,1)),('0.0',(10,1)),('0.0',(20,1)))))

class IsotoProfileFigure(Figure):
     def __init__(self, *args, **kwargs):
         self.linestyles = grey_linestyles

     def plot(self, gases, label='_nolegend'):
         style = self.linestyles.next() #TODO: allow for usual style modifiers passed in
         self.isoaxis.plot(deltas,self.verts,label=label, **style)

···

On Mar 9, 2010, at 9 Mar, 1:52 PM, Alan G Isaac wrote:

I need a figure containing color line plots to
be changed to grayscale, cycling through line
styles instead of colors. How?

Thanks,
Alan Isaac

PSI suppose I searched the web ineffectively on this,
but I did try.

------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Chloe Lewis
Graduate student, Amundson Lab
Ecosystem Sciences
137 Mulford Hall
Berkeley, CA 94720-3114
http://nature.berkeley.edu/~chlewis

Hi Chloe. I deduce from your approach that there is nothing
built in. I am surprised: are most people able to publish color
plots in their articles these days, so that the needed for a
cycle of greyscale linestyles is too rare to make it into
Matplotlib?

Thanks!
Alan

···

On Mar 9, 2010, at 9 Mar, 1:52 PM, Alan G Isaac wrote:
> I need a figure containing color line plots to
> be changed to grayscale, cycling through line
> styles instead of colors. How?

On 3/9/2010 10:45 PM, Chloe Lewis wrote:

Here's a skeleton, for a series of lines that get darker and more
solid (from past to present, as I use it):

[...] I deduce from your approach that there is nothing
built in. I am surprised [...]

When you mentioned it, so was I. From axes.py:

···

--------
def set_default_color_cycle(clist):
     """
     Change the default cycle of colors that will be used by the plot
     command. This must be called before creating the
     :class:`Axes` to which it will apply; it will
     apply to all future axes.

     *clist* is a sequence of mpl color specifiers

     """
     _process_plot_var_args.defaultColors = clist[:]
     rcParams['lines.color'] = clist[0]

--------

That will tidy things up a bit.

Not only do I change to B&W for plots I expect to print, I try to switch fonts and DPI and so forth as a group for print vs. screen vs. projector. I don't have that all ironed out yet, though.

&C