Eric, 
Thanks, that worked...

I have a separate question about colormaps...
I'd also like to try creating my own custom colormap by modifying an
existing cmap, inserting/removing colors by changing the values in the rgb
dictionary...

How do I retrieve the actual rgb dictionary associated with, say, cm.jet?

Thanks,
P.Romero

-----Original Message-----
From: Eric Firing [mailto:efir...@hawaii.edu] 
Sent: 2009-08-14 12:49 PM
To: P.R.
Cc: matplotlib-users@lists.sourceforge.net
Subject: Re: [Matplotlib-users] mpl.colors.BoundaryNorm question

Eric Firing wrote:

It occurred to me after posting that imshow by default gives a 
misleading picture of the effect of the cmap and boundary norm.  To get 
a clear picture, add the "interpolation='nearest'" kwarg to the imshow call.

Eric

> 
> import numpy as np
> import matplotlib.pyplot as plt
> import matplotlib.colors as mcolors
> import matplotlib.cm as cm
> 
> 
> boundaries = np.linspace(20, 30, 11)
> colors = cm.spectral(np.linspace(0.3, 0.8, 10))
> cmap = mcolors.ListedColormap(colors)
> norm = mcolors.BoundaryNorm(boundaries, cmap.N)
> 
> z = 20 + np.random.rand(10,20)*10
> plt.imshow(z, cmap=cmap, norm=norm)
> plt.colorbar()
> plt.show()
> 


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to