Alan G Isaac wrote: > On Fri, 11 Apr 2008, Eric Firing apparently wrote: >> It sounds like what you want is a listed colormap with direct indexing >> using a NoNorm() instance as the norm: > >> cmap = mpl.colors.ListedColormap(['k', 'r', 'b']) >> norm = mpl.colors.NoNorm() >> matshow(aa, cmap=cmap, norm=norm, interpolation='nearest') > > Perfect! > > I actually had found ListedColormap in the docs. > It's name was very promising but the __init__ function had > no help. Can I suggest adding at least the following: > > `colors` is a sequence of Matplotlib colors. > `name` is a string (a name assigned to this colormap).
Good point. I have added a docstring. In the process I did a little checking, found a bug (only for the odd case where N is specified and is less than the length of the list of colors), and fixed it. > > Seems obvious in retrospect, but of course that's too late ... > > By the way, how is the name attribute used? I'm not sure whether it is actually being used by anyone, but having a name attribute for each colormap could make it easier manage a set of colormaps. Eric > > Thanks, > Alan ------------------------------------------------------------------------- This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users