Hi there
I have a script where I create a map (using mapcalc) and I want to attribute a color (gray for instance) but it ranges from 0 to 5 so I cannot attribute gray0-1 neither gray0-255. What can I do to attribute a color table that stretches its color attibution to the image max and minimum values?
Thanks
Luis
Luis Lisboa wrote:
I have a script where I create a map (using mapcalc) and I want to attribute
a color (gray for instance) but it ranges from 0 to 5 so I cannot attribute
gray0-1 neither gray0-255. What can I do to attribute a color table that
stretches its color attibution to the image max and minimum values?
"color=grey" maps the minimum value to black and the maximum to white.
If you can't find an existing set of rules which produce the desired
result, use rules= to specify custom rules. The syntax is documented
in the r.colors manual page.
--
Glynn Clements <glynn@gclements.plus.com>
Hi there
I have a script where I create a map (using mapcalc) and I want to attribute a color (gray for instance) but it ranges from 0 to 5 so I cannot attribute gray0-1 neither gray0-255. What can I do to attribute a color table that stretches its color attibution to the image max and minimum values?
How about creating a color rules file with percentages (instead of values), then, regardless of the actual raster values, the colors will be “automatically” spread between the min and max color. i.e.
0% 0 0 0
100% 255 255 255
This will create a spread of colors from black to white. Now in your script just apply this rules file. If the raster contains 5 values, they will get colored black, dark grey, mid grey, light grey, and white.
···
--
Micha Silver
Arava Development Co. +972-52-3665918
[http://surfaces.co.il](http://surfaces.co.il)
Micha Silver wrote:
> I have a script where I create a map (using mapcalc) and I want to
> attribute a color (gray for instance) but it ranges from 0 to 5 so I
> cannot attribute gray0-1 neither gray0-255. What can I do to attribute
> a color table that stretches its color attibution to the image max and
> minimum values?
>
How about creating a color rules file with percentages (instead of
values), then, regardless of the actual raster values, the colors will
be "automatically" spread between the min and max color. i.e.
0% 0 0 0
100% 255 255 255
This will create a spread of colors from black to white.
That's exactly what color=grey does:
$ cat $GISBASE/etc/colors/grey
0% black
100% white
More generally, these use only relative (percentage) values:
aspect bcyr bgyr byg byr elevation grey gyr haxby rainbow ramp
ryb ryg sepia wave
--
Glynn Clements <glynn@gclements.plus.com>