1r.colors(1)                 GRASS GIS User's Manual                r.colors(1)
2
3
4

NAME

6       r.colors   -  Creates/modifies the color table associated with a raster
7       map.
8

KEYWORDS

10       raster, color table
11

SYNOPSIS

13       r.colors
14       r.colors --help
15       r.colors     [-rwldngae]       [map=name[,name,...]]        [file=name]
16       [color=style]      [raster=name]      [raster_3d=name]     [rules=name]
17       [--help]  [--verbose]  [--quiet]  [--ui]
18
19   Flags:
20       -r
21           Remove existing color table
22
23       -w
24           Only write new color table if it does not already exist
25
26       -l
27           List available rules then exit
28
29       -d
30           List available rules with description then exit
31           If a color rule is given, only this rule is listed
32
33       -n
34           Invert colors
35
36       -g
37           Logarithmic scaling
38
39       -a
40           Logarithmic-absolute scaling
41
42       -e
43           Histogram equalization
44
45       --help
46           Print usage summary
47
48       --verbose
49           Verbose module output
50
51       --quiet
52           Quiet module output
53
54       --ui
55           Force launching GUI dialog
56
57   Parameters:
58       map=name[,name,...]
59           Name of raster map(s)
60
61       file=name
62           Input file with one map name per line
63           Input map names can be defined in an input file  in  case  a  large
64           amount  of  maps must be specified. This option is mutual exclusive
65           to the map option.
66
67       color=style
68           Name of color table
69           Options: aspect, aspectcolr, bcyr, bgyr, blues, byg, byr,  celsius,
70           corine, curvature, differences, elevation, etopo2, evi, fahrenheit,
71           forest_cover, gdd, grass, greens, grey, grey.eq, grey.log, grey1.0,
72           grey255,  gyr,  haxby,  inferno,  kelvin,  magma, ndvi, ndwi, nlcd,
73           oranges, plasma, population, population_dens,  precipitation,  pre‐
74           cipitation_daily,  precipitation_monthly,  rainbow,  ramp,  random,
75           reds, roygbiv, rstcurv, ryb, ryg, sepia, slope, soilmoisture, srtm,
76           srtm_plus, terrain, viridis, water, wave
77            aspect: aspect oriented grey colors [range: map values]
78            aspectcolr: aspect oriented rainbow colors [range: 0 to 360]
79            bcyr: blue through cyan through yellow to red [range: map values]
80            bgyr: blue through green through yellow to red [range: map values]
81            blues: white to blue [range: map values]
82            byg: blue through yellow to green [range: map values]
83            byr: blue through yellow to red [range: map values]
84            celsius: blue to red for degree Celsius temperature [range: -80 to
85           80]
86            corine: EU Corine land cover colors [range: 111 to 995]
87            curvature:   for   terrain   curvatures   (from   v.surf.rst   and
88           r.slope.aspect) [range: map values]
89            differences: differences oriented colors [range: map values]
90            elevation:  maps  relative  ranges  of  raster values to elevation
91           color ramp [range: map values]
92            etopo2: colors for ETOPO2 worldwide bathymetry/topography  [range:
93           -11000 to 8850]
94            evi: enhanced vegetative index colors [range: -1 to 1]
95            fahrenheit: blue to red for Fahrenheit temperature [range: -112 to
96           176]
97            forest_cover: percentage of forest cover [range: 0 to 100]
98            gdd: accumulated growing degree days [range: 0 to 6000]
99            grass: GRASS GIS green (perceptually uniform) [range: map values]
100            greens: white to green [range: map values]
101            grey: grey scale [range: map values]
102            grey.eq: histogram-equalized grey scale [range: map values]
103            grey.log: histogram logarithmic transformed grey scale [range: map
104           values]
105            grey1.0: grey scale for raster values between 0.0-1.0 [range: 0 to
106           1]
107            grey255: grey scale for raster values between 0-255 [range:  0  to
108           255]
109            gyr: green through yellow to red [range: map values]
110            haxby:  relative  colors  for bathymetry or topography [range: map
111           values]
112            inferno:  perceptually  uniform  sequential  color  table  inferno
113           [range: map values]
114            kelvin: blue to red for temperature in Kelvin scale [range: 193.15
115           to 353.15]
116            magma: perceptually uniform sequential color table  magma  [range:
117           map values]
118            ndvi:  Normalized Difference Vegetation Index colors [range: -1 to
119           1]
120            ndwi: Normalized Difference Water Index  colors  [range:  -200  to
121           200]
122            nlcd: US National Land Cover Dataset colors [range: 0 to 95]
123            oranges: white to orange [range: map values]
124            plasma: perceptually uniform sequential color table plasma [range:
125           map values]
126            population: color table covering human  population  classification
127           breaks [range: 0 to 2e+09]
128            population_dens:  color  table  covering  human population density
129           classification breaks [range: 0 to 1e+09]
130            precipitation: precipitation color table (0..2000mm) [range: 0  to
131           7000]
132            precipitation_daily: precipitation color table (0..1000mm) [range:
133           0 to 10000]
134            precipitation_monthly:  precipitation  color   table   (0..1000mm)
135           [range: 0 to 1000]
136            rainbow: rainbow color table [range: map values]
137            ramp: color ramp [range: map values]
138            random: random color table [range: map values]
139            reds: white to red [range: map values]
140            roygbiv:  [range: map values]
141            rstcurv: terrain curvature (from r.resamp.rst) [range: map values]
142            ryb: red through yellow to blue [range: map values]
143            ryg: red through yellow to green [range: map values]
144            sepia: yellowish-brown through to white [range: map values]
145            slope:  r.slope.aspect-type  slope  colors  for raster values 0-90
146           [range: 0 to 90]
147            soilmoisture: soilmoisture color table (0.0-1.0) [range: 0 to 1]
148            srtm: color palette for Shuttle Radar Topography Mission elevation
149           [range: -11000 to 8850]
150            srtm_plus: color palette for Shuttle Radar Topography Mission ele‐
151           vation (with seafloor colors) [range: -11000 to 8850]
152            terrain: global elevation color table covering  -11000  to  +8850m
153           [range: -11000 to 8850]
154            viridis:  perceptually  uniform  sequential  color  table  viridis
155           [range: map values]
156            water: water depth [range: map values]
157            wave: color wave [range: map values]
158
159       raster=name
160           Raster map from which to copy color table
161
162       raster_3d=name
163           3D raster map from which to copy color table
164
165       rules=name
166           Path to rules file
167           "-" to read rules from stdin
168

DESCRIPTION

170       r.colors allows the user to create and/or modify the color table for  a
171       raster  map or several raster maps at once.  The raster maps (specified
172       on the command line by map or as file using an input file with one  map
173       name per line) must exist in the user’s current mapset search path.
174
175       The  raster  option allows user to specify a raster map name from which
176       to copy the color map.
177
178       The raster_3d option allows user to specify a 3D raster map  name  from
179       which to copy the color map.
180
181       The  -e  flag  equalizes the original raster’s color table. It can pre‐
182       clude the need for grey.eq rule, when used as -e color=grey. Note  how‐
183       ever,   that   this   will   not  yield  a  color  table  identical  to
184       color=grey.eq, because grey.eq scales the fraction by 256 to get a grey
185       level, while -e uses it to interpolate the original color table. If the
186       original color table is a 0-255 grey scale, -e is  effectively  scaling
187       the  fraction  by 255. Different algorithms are used. -e is designed to
188       work with any color table, both the  floating  point  and  the  integer
189       raster maps.
190
191       The  -g flag divides the raster’s grey value range into 100 logarithmi‐
192       cally equal steps (where "step" is a rule with the same grey level  for
193       the  start and end points). It can preclude the need for grey.log rule,
194       when used as -g color=grey. Note however, that this will  not  yield  a
195       color table identical to color=grey.log. Different algorithms are used.
196       Unlike color=grey.log, -g is designed to work with both floating  point
197       and integer rasters, without performance issues with large datasets, of
198       any original color table. Logarithmic scaling doesn’t work on  negative
199       values.  In  the  case  when  the value range includes zero, there’s no
200       realistic solution.
201
202       The -e and -g flags are not mutually exclusive.
203
204       If the user specifies the -w flag, the current color table file for the
205       input  map  will not be overwritten. This means that the color table is
206       created only if the map does not already have a color  table.  If  this
207       option  is  not  specified, the color table will be created if one does
208       not exist, or modified if it does.
209
210       Color table  types  aspect,  grey,  grey.eq  (histogram-equalized  grey
211       scale), byg (blue-yellow-green), byr (blue-yellow-red), gyr (green-yel‐
212       low-red), rainbow, ramp, ryg (red-yellow-green), random, and  wave  are
213       pre-defined  color tables that r.colors knows how to create without any
214       further input.
215
216       In case several input raster maps are provided the range (min, max)  of
217       all maps will be used for color table creation. Hence the created color
218       table will span from the smallest minimum to the largest maximum  value
219       of all input raster maps and will be applied to all input raster maps.
220
221       In  general,  tables  which  associate colors with percentages (aspect,
222       bcyr, byg, byr, elevation, grey, gyr, rainbow, ramp, ryb, ryg and wave)
223       can  be  applied  to  any  data,  while those which use absolute values
224       (aspectcolr, curvature, etopo2, evi, ndvi, population, slope, srtm, and
225       terrain)  only  make sense for data with certain ranges.  One can get a
226       rough idea of the applicability of a colour table by reading the corre‐
227       sponding  rules  file  ($GISBASE/etc/colors/<name>).   For  example the
228       slope rule is defined as:
229       0  255:255:255
230       2  255:255:0
231       5  0:255:0
232       10 0:255 255
233       15 0:0:255
234       30 255:0:255
235       50 255:0:0
236       90 0:0:0
237
238       This is designed for the slope map generated by  r.slope.aspect,  where
239       the value is a slope angle between 0 and 90 degrees.
240
241       Similarly, the aspectcolr rule:
242       0 white
243       1 yellow
244       90 green
245       180 cyan
246       270 red
247       360 yellow
248
249       is  designed  for the aspect maps produced by r.slope.aspect, where the
250       value is a heading between 0 and 360 degrees.
251
252       The rules color table type will cause  r.colors  to  read  color  table
253       specifications from standard input (stdin) and will build the color ta‐
254       ble accordingly.
255
256       Using color table type rules, there are two ways to build a  color  ta‐
257       ble:  by category values and by "percent" values.
258
259       To  build  a  color  table by category values’ indices, the user should
260       determine the range of category values in the raster map with which the
261       color table will be used. Specific category values will then be associ‐
262       ated with specific colors. Note that  a  color  does  not  have  to  be
263       assigned  for every valid category value because r.colors will interpo‐
264       late a color ramp to fill in where color specification rules have  been
265       left out. The format of such a specification is as follows:
266       category_value color_name
267       category_value color_name
268       .. ..
269       .. ..
270       category_value color_name
271       end
272
273       Each  category  value must be valid for the raster map, category values
274       must be in ascending order and only  use  standard  GRASS  color  names
275       (aqua,  black,  blue,  brown, cyan, gray, green, grey, indigo, magenta,
276       orange, purple, red, violet, white, yellow).
277
278       Colors can also be specified by color numbers each in the range  0-255.
279       The  format  of  a category value color table specification using color
280       numbers instead of color names is as follows:
281       category_value red_number:green_number:blue_number
282       category_value red_number:green_number:blue_number
283       .. .. .. ..
284       .. .. .. ..
285       category_value red_number:green_number:blue_number
286       end
287
288       Specifying a color table by "percent" values  allows  one  to  treat  a
289       color table as if it were numbered from 0 to 100. The format of a "per‐
290       cent" value color table specification is the same  as  for  a  category
291       value color specification, except that the category values are replaced
292       by "percent" values, each from 0-100, in ascending order. The format is
293       as follows:
294       percent_value% color_name
295       percent_value% color_name
296       .. ..
297       .. ..
298       percent_value% color_name
299       end
300
301       Using  "percent" value color table specification rules, colors can also
302       be specified by color numbers each in the range 0-255. The format of  a
303       percent  value color table specification using color numbers instead of
304       color names is as follows:
305       percent_value% red_number:green_number:blue_number
306       percent_value% red_number:green_number:blue_number
307       .. .. .. ..
308       .. .. .. ..
309       percent_value% red_number:green_number:blue_number
310       end
311
312       Note that you can also mix these two methods of color table  specifica‐
313       tion; for example:
314       0 black
315       10% yellow
316       78 blue
317       100% 0:255:230
318       end
319
320       To set the NULL (no data) color, use the "nv" (null values) parameter:
321       0 black
322       10% yellow
323       nv white
324       end
325
326       To  set the color to used for undefined values (beyond the range of the
327       color rules) use the "default" parameter:
328       0 red
329       1 blue
330       default grey
331       end
332

NOTES

334       All  color  tables  are   stored   in   $GISBASE/etc/colors/.   Further
335       user-defined  color  tables  can  also  be stored in this directory for
336       access from the color parameter or in a user  defined  directory.   See
337       also r.colors.out for printing color tables easily to the terminal.
338
339       The  color  table assigned to a raster map is stored in $GISDBASE/loca‐
340       tion/mapset/colr/.
341

EXAMPLES

343       The below example shows how you can specify colors for a three category
344       map, assigning red to category 1, green to category 2, and blue to cat‐
345       egory 3. Start by using a text editor to  create  the  following  rules
346       specification file (save it with the name rules.file):
347       1 red
348       2 green
349       3 blue
350       end
351
352       The  color table can then by assigned to map threecats by the following
353       GRASS commands (two ways are available):
354       # read input from stdin
355       cat rules.file | r.colors map=threecats rules=-
356       # read directly from file
357       r.colors map=threecats rules=rules.file
358
359       To create a natural looking lookup table (LUT) for true map layer  ele‐
360       vation,  use  the  following  rules  specification file. It will assign
361       light green shades to the lower elevations (first 20% of the LUT),  and
362       then darker greens (next 15%, and next 20%) and light browns (next 20%)
363       for middle elevations, and darker browns (next 15%) for  higher  eleva‐
364       tions, and finally yellow for the highest peaks (last 10% of LUT).
365       0% 0:230:0
366       20% 0:160:0
367       35% 50:130:0
368       55% 120:100:30
369       75% 120:130:40
370       90% 170:160:50
371       100% 255:255:100
372
373       To invert the current rules:
374       r.colors map=current_raster -n rast=current_raster
375

SEE ALSO

377         d.colortable,  d.histogram,  d.legend,  r.colors.out r.colors.stddev,
378       r.support, r.univar, v.colors, v.colors.out, r3.colors, r3.colors.out
379
380       See also wiki page Color tables (from GRASS User Wiki)
381
382       ColorBrewer is an online tool designed to help people select good color
383       schemes for maps and other graphics.
384

AUTHORS

386       Michael Shapiro and David Johnson
387       Support for 3D rasters by Soeren Gebbert
388

SOURCE CODE

390       Available at: r.colors source code (history)
391
392       Main  index  | Raster index | Topics index | Keywords index | Graphical
393       index | Full index
394
395       © 2003-2020 GRASS Development Team, GRASS GIS 7.8.5 Reference Manual
396
397
398
399GRASS 7.8.5                                                        r.colors(1)
Impressum