[Matplotlib-users] strange coloring of a tiled raster image

2008-04-11 Thread cr blimp
Hello, I wish to plot 4 different raster images within a figure, and later plot registered lines highlighting certain features of them. Here is the code to read one image and plot it, works as expcted: img = Image.open(sys.argv[1]) img1 = numpy.asarray(img) pylab.figure() pylab.imshow(img1) pyl

[Matplotlib-users] anim.py questions

2008-04-11 Thread Alan G Isaac
I have a couple questions about anim.py: http://matplotlib.sourceforge.net/examples/anim.py I'm running Python 2.5.1 and Matplotlib 0.90.1 under Win 2000. 1. Running anim.py at DOS prompt: it runs correctly until the end: Fatal Python error: PyEval_RestoreThread: NULL tstate This appli

[Matplotlib-users] integers -> colors

2008-04-11 Thread Alan G Isaac
I have an integer array. The number of different integers is small, so small that I would like to define an integer to color mapping and use this with matshow. E.g., 0 -> black 1 -> red 2 -> blue etc Possible? Thank you, Alan Isaac -

Re: [Matplotlib-users] integers -> colors

2008-04-11 Thread Eric Firing
Alan, It sounds like what you want is a listed colormap with direct indexing using a NoNorm() instance as the norm: aa = ones((2,3), dtype=int) aa[0,0] = 0 aa[:,2] = 2 cmap = mpl.colors.ListedColormap(['k', 'r', 'b']) norm = mpl.colors.NoNorm() matshow(aa, cmap=cmap, norm=norm, interpolation='ne