# matplotlib-users@lists.sourceforge.net

Sorry, forgot to copy the list.

···

On 6/27/07, Ryan Krauss <ryanlists@...287...> wrote:

I think what you are asking is how to make mpl plot different line
types in colors and styles that are easily distinguishable when
plotted in grayscale. I had tinkered with this a bit in the past and
the final suggestion was to write some helper functions so that I
could do the following:

from mycyclers import colorcycler, linecycler

for data in mydata:
ax.plot(data, linestyle=linecycler(), color=colorcycler())

so that by writing a linecycler function I could control the line
types plotted each time and the same with the color. Color would be
specified as a grayscale such as '#808080' for a medium gray or
'#000000' for black.

I didn't actually do it this way or I would post the code (I was in a
hurry and did something hackish). I think that linecycler and
colorcycler would be helper classes thta increment there own internal
count when called and return a linestyle or color.

I think what you want in the end is a simple way to do this:

t=arange(0,1,0.01)
y=sin(2*pi*t)
x=cos(2*pi*t)
plot(t,x,color='#000000',linestyle='-')
plot(t,y,color='#808080',linestyle=':')

where color and line style would increment pseudo-automatically
through lists you have defined and that you like.

A slightly better approach might be:
t=arange(0,1,0.01)
y=sin(2*pi*t)
x=cos(2*pi*t)
data=[x,y]
mycolors=['#000000','#808080']
mytypes=['-',':']

def grayscaleplot(data,t):
for n,item in enumerate(data):
plot(t,item, color=mycolors[n], linestyle=mytypes[n])

FWIW,

Ryan

On 6/27/07, Emmanuel Favre-Nicolin <manouchk@...287...> wrote:
> Hi,
>
> I didn't find any tip for preparation of simple black and white 2D plot,
> especially for nice output in eps for publication.
>
> Any suggestions are welcome.
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by DB2 Express
> Download DB2 Express C - the FREE version of DB2 express and take
> control of your XML. No limits. Just data. Click to get it now.
> http://sourceforge.net/powerbar/db2/
> _______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> matplotlib-users List Signup and Options
>