I'm trying to create a custom colormap used with pcolormesh, but the results seem inconsistent to me. I want the following colors
-3 < x <= -2 ----- Black -2 < x <= -1 ----- Blue -1 < x <= 0 ----- Yellow 0 < x <= 1 ----- Green 1 < x <= inf ----- Red A minimal example is copied below. I have a 2-D array that looks like: -1, 6, 2.5 1.3, -2, 4/3 2.5, 6, 0 I want to get a pcolormesh that looks like R R Y R K R B R R But instead I get: Y R B Y K Y K R Y I recognize that the pcolormesh is plotted "upside-down" from how the matrix is printed. I apparently don't understand how to use a custom colormap. I have tried to follow the example here: http://matplotlib.sourceforge.net/examples/api/colorbar_only.html but haven't been too successful. It seems like there is a normalization going on that I can't seem to track down. Can anyone see what is wrong? Thanks, Jeremy import numpy import matplotlib.pyplot as pyplot import matplotlib.colors C = numpy.array([[-1,6,2.5],[4/3., -2, 4/3.],[2.5,6,0.0]],dtype=float) cMap = matplotlib.colors.ListedColormap(['k', 'b', 'y', 'g', 'r']) Bounds = [-3.0, -2.0, -1.0, 0.0, 1.0, numpy.inf] # Plot Fig = pyplot.figure() pyplot.pcolormesh(C, cmap=cMap) ------------------------------------------------------------------------------ Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)! Finally, a world-class log management solution at an even better price-free! Download using promo code Free_Logger_4_Dev2Dev. Offer expires February 28th, so secure your free ArcSight Logger TODAY! http://p.sf.net/sfu/arcsight-sfd2d _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users