Re: a bunch of extra colormaps

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: a bunch of extra colormaps

Helge Avlesen
On 8/26/05, Jeff Whitaker <[hidden email]> wrote:
> "def get_cmap" line (although this will not make them available via
> pylab calls like 'jet()' and 'hot()'). To get a quick view of what the

this is great, and I think the matlab way with a function for each
color map pollutes the namespace too much. I humbly suggest a syntax
like
  colormap('hot')
or to give bluetones for values < 0, greenish and brown above:
  colormap('earth', zerolevel=0.0)
etc. for pylab

Helge


-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Matplotlib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: a bunch of extra colormaps

Vidar Gundersen
===== 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


-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Matplotlib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: a bunch of extra colormaps

John Hunter-8
>>>>> "Vidar" == Vidar Gundersen <[hidden email]> writes:

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

I haven't been able to find any licensing information for the color
scales at colorbrewer or http://geography.uoregon.edu/datagraphics .
Does anyone know what their license is, if any?

JDH


-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Matplotlib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: a bunch of extra colormaps

Jeff Whitaker
John Hunter wrote:

>>>>>>"Vidar" == Vidar Gundersen <[hidden email]> writes:
>>>>>>            
>>>>>>
>
>    Vidar> thanks for providing this, i hope this will be included in
>    Vidar> the matplotlib distribution, along with your script for
>    Vidar> previewing and listing all colormaps?  (see modification of
>    Vidar> original code below.)
>
>I haven't been able to find any licensing information for the color
>scales at colorbrewer or http://geography.uoregon.edu/datagraphics .
>Does anyone know what their license is, if any?
>
>JDH
>
>  
>
John: Colorbrewer uses an apache-style license
(http://www.personal.psu.edu/faculty/c/a/cab38/ColorBrewer/ColorBrewer_updates.html).  
I don't know about the DataGraphics color schemes.

-Jeff

--
Jeffrey S. Whitaker         Phone : (303)497-6313
NOAA/OAR/CDC  R/CDC1        FAX   : (303)497-6449
325 Broadway                Web   : http://www.cdc.noaa.gov/~jsw
Boulder, CO, USA 80305-3328 Office: Skaggs Research Cntr 1D-124



-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Matplotlib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Loading...