[GRASS-user] r.colors

Michael Barton Michael.Barton at asu.edu
Thu Mar 28 09:29:25 PDT 2013


You can do this with a couple of different interfaces, including a text file, which might work better in your case. The syntax is the same, however. It involves giving a cut point for the raster values and a color at that cut point. GRASS then will shade between the cut points. For example:

0 red
10 blue

…will make a 0 value red (255:0:0 in RGB), a value of 10 blue (0:0:255 in RGB) and grade from red to blue for all intermediate values.

You can express the same thing with RGB values (note the colons separating the color values)

0 255:0:0
10 0:0:255

If you're values vary but you always want them to scale between red and blue, you can also express this as

0% red
100% blue

You can mix and match raw values and percents, named colors and RGB values.

In your particular case, you could do…

0 yellow
1 yellow
7 purple
100% purple

This makes 0-1 yellow, 7 purple, and everything above 7 purple. The other values will always grade between yellow and purple. If you want to put in some other cut points to make sure that particular values have particular colors, you can do so.

0 yellow
1 yellow
3 green
5 red
7 purple
100% purple

The result is…

0-1 is yellow
1-3 grades between yellow and green
3 is green
3-5 grades between green and red
5 is red
5-7 grades between red and purple
7 on up is purple

Hope this makes the r.colors less mysterious.

Cheers
Michael
______________________________
C. Michael Barton
Director, Center for Social Dynamics & Complexity
Professor of Anthropology, School of Human Evolution & Social Change
Arizona State University
Tempe, AZ  85287-2402
USA

voice:  480-965-6262 (SHESC), 480-727-9746 (CSDC)
fax:          480-965-7671(SHESC), 480-727-0709 (CSDC)
www:  http://csdc.asu.edu, http://shesc.asu.edu
http://www.public.asu.edu/~cmbarton

On Mar 28, 2013, at 5:54 AM, Nathan Barber - NOAA Federal <nathan.barber at noaa.gov<mailto:nathan.barber at noaa.gov>> wrote:

Background

We generate a precipitation graphic that is based on the mean of an ensemble of models.  Because it goes out 16 days, we can have a wide variety of amounts...sometimes it can be as little as 2 inches other times it can be as great as 6 or 7.  This variability can cause some issues with users when our color scale always changes relative to the amounts.  For example Day 1, 1 inch is yellow and 3 inches is purple....Day 2, 2 inches is yellow and 6 inches is purple.

Is there a way to categorize amounts, say 0-1, 1-2, 2-3, 4-5, 5-6, 7+ so that purple will always represent 7+ and yellow will always be 0-1, etc...I've looked at the r.colors wiki page but I can't seem to get the rules to work correctly.  I need a consistent color scheme for the graphic that communicates the level of concern properly to the user.

Any examples would be greatly appreciated...Thanks.

--
Nathan Barber
Hydrologist
NOAA National Weather Service
Ohio River Forecast Center<http://www.erh.noaa.gov/ohrfc/>
1901 S State Rt 134
Wilmington, OH  45177
(937) 383-0528

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-user/attachments/20130328/b381021b/attachment-0001.html>


More information about the grass-user mailing list