# colormap question

Hello, I have a quick question for you.

I was trying to make a color and contour plot. But the problem is that
the matplot defaults the colors from the dark to light for the contour
values from minimum to maximum, is there any way or commands to reverse
this order? I mean the dark color for maximum value and light color for
minimum.

Thank you so much!

///Teng

Teng Yang wrote:

Hello, I have a quick question for you.

I was trying to make a color and contour plot. But the problem is that
the matplot defaults the colors from the dark to light for the contour
values from minimum to maximum, is there any way or commands to reverse
this order? I mean the dark color for maximum value and light color for
minimum.

Thank you so much!

///Teng

Teng: Simply append '_r' to the colormap name to get the colors reversed (e.g. cmap = pylab.cm.hot_r instead of pylab.cm.hot).

-Jeff

···

--
Jeffrey S. Whitaker Phone : (303)497-6313
Meteorologist FAX : (303)497-6449
NOAA/OAR/PSD R/PSD1 Email : Jeffrey.S.Whitaker@...259...
325 Broadway Office : Skaggs Research Cntr 1D-124
Boulder, CO, USA 80303-3328 Web : http://tinyurl.com/5telg

Jeff,

This "_r" command seems not work well. Let me show you the full
line of that color map plot,

···

--------------------------------------
contourf(X, Y, Z, v1, cmap=cm.pink)
--------------------------------------

By the way, Jeff, do you know how to make the cmap explicitly defined,
like in GNUPLOT,
----------------------------------------------------------------
set palette defined (0.004 "white", 0.17 "brown", 0.28 "black")
----------------------------------------------------------------

Thank you so much!

///Teng

Jeff Whitaker writes:

Teng Yang wrote:

Hello, I have a quick question for you.

I was trying to make a color and contour plot. But the problem is that
the matplot defaults the colors from the dark to light for the contour
values from minimum to maximum, is there any way or commands to reverse
this order? I mean the dark color for maximum value and light color for
minimum.

Thank you so much!

///Teng

Teng: Simply append '_r' to the colormap name to get the colors reversed (e.g. cmap = pylab.cm.hot_r instead of pylab.cm.hot).

-Jeff

--
Jeffrey S. Whitaker Phone : (303)497-6313
Meteorologist FAX : (303)497-6449
NOAA/OAR/PSD R/PSD1 Email : Jeffrey.S.Whitaker@...259...
325 Broadway Office : Skaggs Research Cntr 1D-124
Boulder, CO, USA 80303-3328 Web : http://tinyurl.com/5telg

///Teng

=======================================
Teng Yang
---------
4240 Biomedical &Physical Sci. Bldg
East Lansing, MI 48824-2320 USA

# (517)355-9200 Ext.2239 (office) (517)282-0791 (mobile) (517)353-4500 (FAX)

Teng Yang wrote:

Jeff,
This "_r" command seems not work well. Let me show you the full
line of that color map plot,
--------------------------------------
contourf(X, Y, Z, v1, cmap=cm.pink)
--------------------------------------

Teng:

Have you tried

contourf(X, Y, Z, v1, cmap=cm.pink_r)

-Jeff

···

--
Jeffrey S. Whitaker Phone : (303)497-6313
NOAA/OAR/CDC R/PSD1 FAX : (303)497-6449
325 Broadway Boulder, CO, USA 80305-3328