After experimenting with colormaps for a while, I was able to make both discrete (piecewise-constant) and continuous (piecewise-linear) colormaps work. Although colormaps can be created directly using LinearSegmentedColormap from the matplotlib.colors package, this is a tedious and error-prone process. So, I compiled a set of three interface functions. (I wrote two of these myself, and got one from the SciPy website). The two functions that I wrote permit one to define a discrete (piecewise-constant) and continuous (piecewise-linear) colormap directly via a sequence of colors and a set of thresholds specified as lists. Each color may be specified either via an RGB tuple or via an English color name known to webcolors.name_to_rgb. I'm submitting this in the hopes that this functionality will be incorporated into matplotlib.
There's one thing that I've not been able to resolve: When attempting to display all defined colormaps using colormaps_test.py (attached), colormaps that I've defined do not show up. So, it would appear that registering a colormap makes it possible to access that colormap only if the name is known to the program that wants to use it. http://www.nabble.com/file/p25665294/make_cmap.py make_cmap.py http://www.nabble.com/file/p25665294/colormaps_test.py colormaps_test.py -- View this message in context: http://www.nabble.com/new-interface-functions-for-LinearSegmentedColormap-tp25665294p25665294.html Sent from the matplotlib - devel mailing list archive at Nabble.com. ------------------------------------------------------------------------------ Come build with us! The BlackBerry® Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now! http://p.sf.net/sfu/devconf _______________________________________________ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel