1r.colors(1) Grass User's Manual r.colors(1)
2
3
4
6 r.colors - Creates/Modifies the color table associated with a raster
7 map layer.
8
10 raster
11
13 r.colors
14 r.colors help
15 r.colors [-wql] map=name [color=type] [rast=string] [rules=string]
16
17 Flags:
18 -w Keep existing color table
19
20 -q Quietly
21
22 -l List rules
23
24 Parameters:
25 map=name
26 Name of input raster map
27
28 color=type
29 Type of color table Options:
30 aspect,grey,grey.eq,grey.log,byg,byr,gyr,rainbow,ramp,ran‐
31 dom,ryg,wave,rules aspect: aspect oriented grey colors grey: linear
32 grey scale grey.eq: histogram equalized grey scale grey.log: his‐
33 togram logarithmic transformed grey scale byg: blue through yellow
34 to green colors byr: blue through yellow to red colors gyr: green
35 through yellow to red colors rainbow: rainbow color table ramp:
36 color ramp random: random color table ryg: red through yellow to
37 green colors wave: color wave rules: create new color table by
38 rules
39
40 rast=string
41 Raster map name from which to copy color table
42
43 rules=string
44 Name of predefined rules file Options: byr,ter‐
45 rain,gyr,aspect,srtm,rainbow,etopo2,elevation,byg,evi,popula‐
46 tion,slope,grey,ryg,ramp,bcyr,wave,ndvi
47
49 r.colors allows the user to create and/or modify the color table for a
50 raster map layer. The map layer (specified on the command line by
51 map=name) must exist in the user's current mapset search path. The
52 color table specified by color=type must be one of the following:
53 color type description
54 aspect (aspect oriented grey colors)
55 grey (grey scale)
56 grey.eq (histogram-equalized grey scale)
57 grey.log (histogram logarithmic transformed grey scale)
58 byg (blue through yellow to green colors)
59 byr (blue through yellow to red colors)
60 gyr (green through yellow to red colors)
61 rainbow (rainbow color table)
62 ramp (color ramp)
63 random (random color table)
64 ryg (red through yellow to green colors)
65 wave (color wave)
66 rules (create new color table based on user-specified
67 rules)
68 Additionally there is a set of extra color tables (aspect, bcyr, byg,
69 byr, elevation, grey, gyr, rainbow, ramp, ryg, slope, terrain, wave)
70 which are stored in $GISBASE/etc/colors/.
71
72 If the user specifies the -w flag, the current color table file for the
73 input map will not be overwritten. This means that the color table is
74 created only if the map does not already have a color table. If this
75 option is not specified, the color table will be created if one does
76 not exist, or modified if it does.
77
78 If the user sets the -q flag, r.colors will run quietly, Without print‐
79 ing numerous messages on its progress to standard output.
80
81 Color table types aspect, grey, grey.eq (histogram-equalized grey
82 scale), byg (blue-yellow-green), byr (blue-yellow-red), gyr (green-yel‐
83 low-red), rainbow, ramp, ryg (red-yellow-green), random, and wave are
84 pre-defined color tables that r.colors knows how to create without any
85 further input.
86
87 The rules color table type will cause r.colors to read color table
88 specifications from standard input (stdin) and will build the color ta‐
89 ble accordingly.
90
91 Using color table type rules, there are three ways to build a color ta‐
92 ble: by color list, by category values, and by "percent" values.
93
94 Building a customized color table by color list is the simplest of the
95 three rules methods: just list the colors you wish to appear in the
96 color table in the order that you wish them to appear. Use the standard
97 GRASS color names: white, black, red, green, blue, yellow, magenta,
98 cyan, aqua, grey, gray, orange, brown, purple, violet, and indigo.
99
100 For example, to create a color table for the raster map layer elevation
101 that assigns greens to low map category values, browns to the next
102 larger map category values, and yellows to the still larger map cate‐
103 gory values, one would type:
104
105 r.colors map=elevation color=rules
106 green
107 brown
108 yellow
109 end
110
111 To build a color table by category values' indices, the user should
112 determine the range of category values in the raster map layer with
113 which the color table will be used. Specific category values will then
114 be associated with specific colors. Note that a color does not have to
115 be assigned for every valid category value because r.colors will inter‐
116 polate a color ramp to fill in where color specification rules have
117 been left out. The format of such a specification is as follows:
118
119 category_value color_name
120 category_value color_name
121 .. ..
122 .. ..
123 category_value color_name
124 end
125
126 Each category value must be valid for the raster map layer, category
127 values must be in ascending order and only use standard GRASS color
128 names (see above).
129
130 Colors can also be specified by color numbers each in the range 0-255.
131 The format of a category value color table specification using color
132 numbers instead of color names is as follows:
133
134 category_value red_number green_number blue_number
135 category_value red_number green_number blue_number
136 .. .. .. ..
137 .. .. .. ..
138 category_value red_number green_number blue_number
139 end
140
141 Specifying a color table by "percent" values allows one to treat a
142 color table as if it were numbered from 0 to 100. The format of a "per‐
143 cent" value color table specification is the same as for a category
144 value color specification, except that the category values are replaced
145 by "percent" values, each from 0-100, in ascending order. The format is
146 as follows:
147
148 percent_value% color_name
149 percent_value% color_name
150 .. ..
151 .. ..
152 percent_value% color_name
153 end
154
155 Using "percent" value color table specification rules, colors can also
156 be specified by color numbers each in the range 0-255. The format of a
157 percent value color table specification using color numbers instead of
158 color names is as follows:
159
160 percent_value% red_number green_number blue_number
161 percent_value% red_number green_number blue_number
162 .. .. .. ..
163 .. .. .. ..
164 percent_value% red_number green_number blue_number
165 end
166
167 Note that you can also mix these three methods of color table specifi‐
168 cation; for example:
169
170 0 black
171 10% yellow
172 78 blue
173 magenta
174 purple
175 brown
176 100% 0 255 230
177 end
178
179 To set the NULL (no data) color, use the "nv" parameter:
180
181 0 black
182 10% yellow
183 nv white
184 end
185
187 1 The below example shows how you can specify colors for a three
188 category map, assigning red to category 1, green to category 2,
189 and blue to category 3. Start by using a text editor, like vi,
190 to create the following rules specification file. Save it with
191 the name rules.file.
192
193 1 red
194 2 green
195 3 blue
196 end
197
198 The color table can then by assigned to map threecats by typing the
199 following command at the GRASS> prompt: cat rules.file | r.colors
200 map=threecats color=rules
201
202 2 To create a natural looking LUT for true map layer elevation,
203 use the following rules specification file. It will assign light
204 green shades to the lower elevations (first 20% of the LUT), and
205 then darker greens (next 15%, and next 20%) and light browns
206 (next 20%) for middle elevations, and darker browns (next 15%)
207 for higher elevations, and finally yellow for the highest peaks
208 (last 10% of LUT). 0% 0 230 0
209 20% 0 160 0
210 35% 50 130 0
211 55% 120 100 30
212 75% 120 130 40
213 90% 170 160 50
214
215 Option rast allows user to specify a raster map name from which to copy
216 the color map.
217
219 d.colors, d.colortable, d.legend, r.support
220
221 ColorBrewer is an online tool designed to help people select good color
222 schemes for maps and other graphics
223
225 Michael Shapiro and David Johnson
226
227 Last changed: $Date: 2006/01/01 14:22:13 $
228
229 Full index
230
231
232
233GRASS 6.2.2 r.colors(1)