From: John Hunter <jdh2358@gm...>  20090605 12:52:02

On Thu, Jun 4, 2009 at 6:38 PM, Karl Young<karl.young@...> wrote: > > I have 2 float arrays of the same dimension which I use to generate a > 3rd array, again of the same dimension, containing integers from a small > set (I obtain the 3rd array via clustering in the 2 dimensional space of > points obtained as values from the same location in the initial 2 > arrays). I'd like to do a scatter plot using scatter, with xaxis values > as values from the first array, yvalues as values from the second array > and color of the points corresponding to the integer in the 3rd array > (so far so good; I can do that much). Then I'd like to plot an image > using imshow of the 3rd array with colors corresponding to those in the > scatter plot. I can generate the image with imshow ok but can't the > colors to match those in the scatter plot. Here's a snippet (assume > array1,array2, and array3 are 2D arrays): > > hot() > scatter(array1.ravel(), array2.ravel(), c = > numpy.array(array3.ravel(),float)) > imshow(array3) > show() > > The main problem is that I can't figure out how to force the plot colors > for imshow to correspond to those in scatter. Thanks for any thought or > suggestions. Cheers, w/o a complete, self contained code sample that we can run and play with on our machines, it is harder to help. Have you tried forcing the clim to be set to the interval you want? http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.clim JDH 