a bunch of extra colormaps

===== Original message from Jeff Whitaker | Thu, 25 Aug 2005:

I've created matplotlib colormaps from all the color tables at
http://colorbrewer.org, and
http://geography.uoregon.edu/datagraphics/color_scales.htm

thanks for providing this,
i hope this will be included in the matplotlib distribution,
along with your script for previewing and listing all colormaps?
(see modification of original code below.)

i would like to mention another archive of color gradients,
http://cpt-city.org.uk/. two examples of color gradients
found here that i think might be useful for plotting data:

Nonlinear grays, e.g. gamma={1/3, 0.5, 0.8, 1.25, ..}
(human vision are more sensitive in the lighter range)
http://cpt-city.org.uk/tl/

Subtle close-to-grayscale gradients, like for instance the
sephia and cyanotype tinted monochrome colormaps found here:
http://cpt-city.org.uk/erj/multiple/

"""
   Usage: colormap-preview.py [cmapname]
   Adapted from original code by Jeff Whitaker
   http://sourceforge.net/mailarchive/message.php?msg_id=12764609
"""
import matplotlib.cm as cm
import pylab as p

def plot_colorbar(cmapname,nsteps=None):
   colormap = cm.__dict__[cmapname]
   fig=p.figure(figsize=(8,1))
   ax = fig.add_axes([0.05,0.05,0.9,0.70])
   if nsteps == None:
       nsteps = colormap.N+1
   clevs = p.linspace(0,1,nsteps+1)
   C = p.array([clevs,clevs])
   X,Y = p.meshgrid(clevs,[0,1])
   levs,coll = ax.contourf(C, Y, X, nsteps-1, cmap=colormap)
   ax.set_xticks([])
   ax.set_yticks([])
   p.title(cmapname)
   p.show()

if __name__ == "__main__":
   names = cm.datad.keys()
   import sys
   if len(sys.argv) > 1:
      cmapname = sys.argv[1]
   else:
      print len(names), 'total color maps'
      print sorted(names)
      cmapname = raw_input('color map name: ')

   if cmapname not in names:
       raise KeyError, 'invalid colormap name,' +\
                       ' valid names are '+repr(names)
   plot_colorbar(cmapname)

## end of Python code

···

--
Vidar Bronken Gundersen
blogged: http://www.37mm.no/blog/ColorBrewer_schemes_for_Matplotlib.html