Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a raster map in GRASS containing elevation values. I want to display the elevation values in only one color (specificaly blue) but in varying shades of blue. I tried the options in r.colors, but none of those displays the map in monochrome.

share|improve this question
up vote 9 down vote accepted

In GRASS shell type:

> r.colors map=elevation color=rules 
> 0 white
> [your maximum elevation value] blue
> end
share|improve this answer
Or simply 0% white 100% blue. – Jake Mar 17 '11 at 15:35
I tried creating a shell script containing: #!/bin/sh r.colors map=raster_bulacanOriginal2 color=rules 0 white 300 blue end and GRASS just kept on freezing – teamAngat Mar 17 '11 at 16:22
It's not freezing, it's expecting input. If you want to use it in a shell script, you need to do something like #!/bin/sh echo -e '0 white\n300 blue' | r.colors map=<mapname> color=rules rules=-, which pipes the color rule to the r.colors command. The rules=- option tells r.colors to expect the rule from the pipe. Or you can save the color rule to a file, and use r.colors map=<mapname> color=rules rules=<rulesfile>. – Jake Mar 17 '11 at 17:16
Thanks! I noticed that the color for the rules only uses color names. Can ASCII colors be used? I tried assigning a HEX color to a certain value and it produced this error: ERROR: bad rule (invalid color name): [-25 #00FFFF] – teamAngat Mar 18 '11 at 8:54
According to, you'd have to write '0 255 255' instead of '#00FFFF'. – underdark Mar 18 '11 at 8:58

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.