.TH r.colors 1grass "" "GRASS 6.4.4" "Grass User's Manual" .SH NAME \fI\fBr.colors\fR\fR - Creates/modifies the color table associated with a raster map layer. .SH KEYWORDS raster, color table .SH SYNOPSIS \fBr.colors\fR .br \fBr.colors help\fR .br \fBr.colors\fR [\-\fBrwlngaeiq\fR] [\fBmap\fR=\fIname\fR] [\fBcolor\fR=\fIstyle\fR] [\fBraster\fR=\fIstring\fR] [\fBrules\fR=\fIname\fR] [\-\-\fBverbose\fR] [\-\-\fBquiet\fR] .SS Flags: .IP "\fB\-r\fR" 4m .br Remove existing color table .IP "\fB\-w\fR" 4m .br Only write new color table if one doesn't already exist .IP "\fB\-l\fR" 4m .br List available rules then exit .IP "\fB\-n\fR" 4m .br Invert colors .IP "\fB\-g\fR" 4m .br Logarithmic scaling .IP "\fB\-a\fR" 4m .br Logarithmic-absolute scaling .IP "\fB\-e\fR" 4m .br Histogram equalization .IP "\fB\-i\fR" 4m .br Enter rules interactively .IP "\fB\-q\fR" 4m .br Run quietly .IP "\fB\-\-verbose\fR" 4m .br Verbose module output .IP "\fB\-\-quiet\fR" 4m .br Quiet module output .PP .SS Parameters: .IP "\fBmap\fR=\fIname\fR" 4m .br Name of input raster map .IP "\fBcolor\fR=\fIstyle\fR" 4m .br Type of color table .br Options: \fIaspect,aspectcolr,bcyr,bgyr,byg,byr,celsius,corine,curvature,differences,elevation,etopo2,evi,gdd,grey,grey.eq,grey.log,grey1.0,grey255,gyr,haxby,ndvi,population,population_dens,precipitation,precipitation_monthly,rainbow,ramp,random,rstcurv,rules,ryb,ryg,sepia,slope,srtm,terrain,wave\fR .br \fBaspect\fR: aspect oriented grey colors .br \fBaspectcolr\fR: aspect oriented rainbow colors .br \fBbcyr\fR: blue through cyan through yellow to red .br \fBbgyr\fR: blue through green through yellow to red .br \fBbyg\fR: blue through yellow to green .br \fBbyr\fR: blue through yellow to red .br \fBcelsius\fR: blue to red for degree Celsius temperature .br \fBcorine\fR: EU Corine land cover colors .br \fBcurvature\fR: for terrain curvatures (from v.surf.rst and r.slope.aspect) .br \fBdifferences\fR: differences oriented colors .br \fBelevation\fR: maps relative ranges of raster values to elevation color ramp .br \fBetopo2\fR: colors for ETOPO2 worldwide bathymetry/topography .br \fBevi\fR: enhanced vegetative index colors .br \fBgdd\fR: accumulated growing degree days .br \fBgrey\fR: grey scale .br \fBgrey.eq\fR: histogram-equalized grey scale .br \fBgrey.log\fR: histogram logarithmic transformed grey scale .br \fBgrey1.0\fR: grey scale for raster values between 0.0-1.0 .br \fBgrey255\fR: grey scale for raster values between 0-255 .br \fBgyr\fR: green through yellow to red .br \fBhaxby\fR: relative colors for bathymetry or topography .br \fBndvi\fR: Normalized Difference Vegetation Index colors .br \fBpopulation\fR: color table covering human population classification breaks .br \fBpopulation_dens\fR: color table covering human population density classification breaks .br \fBprecipitation\fR: precipitation color table (0..2000mm) .br \fBprecipitation_monthly\fR: precipitation color table (0..1000mm) .br \fBrainbow\fR: rainbow color table .br \fBramp\fR: color ramp .br \fBrandom\fR: random color table .br \fBrstcurv\fR: terrain curvature (from r.resamp.rst) .br \fBrules\fR: create new color table based on user-specified rules read from stdin .br \fBryb\fR: red through yellow to blue .br \fBryg\fR: red through yellow to green .br \fBsepia\fR: yellowish-brown through to white .br \fBslope\fR: r.slope.aspect-type slope colors for raster values 0-90 .br \fBsrtm\fR: color palette for Shuttle Radar Topography Mission elevation .br \fBterrain\fR: global elevation color table covering -11000 to +8850m .br \fBwave\fR: color wave .IP "\fBraster\fR=\fIstring\fR" 4m .br Raster map name from which to copy color table .IP "\fBrules\fR=\fIname\fR" 4m .br Path to rules file ("-" to read rules from stdin) .PP .SH DESCRIPTION \fIr.colors\fR allows the user to create and/or modify the color table for a raster map layer. The map layer (specified on the command line by \fBmap=\fR\fIname\fR) must exist in the user's current mapset search path. .PP The \fBrast\fR option allows user to specify a raster map \fIname\fR from which to copy the color map. .PP All color tables are stored in $GISBASE/etc/colors/. Further user-defined color tables can also be stored in this directory for access from the \fIcolor\fR parameter. .PP The \fB-e\fR flag equalizes the original raster's color table. It can preclude the need for \fIgrey.eq\fR rule, when used as \fB-e color=\fR\fIgrey\fR. Note however, that this will not yield a color table identical to \fIcolor=grey.eq\fR, because \fIgrey.eq\fR scales the fraction by 256 to get a grey level, while \fB-e\fR uses it to interpolate the original colour table. If the original colour table is a 0-255 grey scale, \fB-e\fR is effectively scaling the fraction by 255. Different algorithms are used. \fB-e\fR is designed to work with any color table, both the floating point and the integer raster maps. .PP The \fB-g\fR flag divides the raster's grey value range into 100 logarithmically equal steps (where "step" is a rule with the same grey level for the start and end points). It can preclude the need for \fIgrey.log\fR rule, when used as \fB-g color=\fR\fIgrey\fR. Note however, that this will not yield a color table identical to \fIcolor=grey.log\fR. Different algorithms are used. Unlike \fBcolor=\fR\fIgrey.log\fR, \fB-g\fR is designed to work with both floating point and integer rasters, without performance issues with large datasets, of any original color table. Logarithmic scaling doesn't work on negative values. In the case when the value range includes zero, there's no realistic solution. .PP The \fB-e\fR and \fB-g\fR flags are not mutually exclusive. .PP If the user specifies the \fB-w\fR flag, the current color table file for the input map will not be overwritten. This means that the color table is created only if the \fImap\fR does not already have a color table. If this option is not specified, the color table will be created if one does not exist, or modified if it does. .PP If the user sets the \fB-q\fR flag, \fIr.colors\fR will run quietly, Without printing numerous messages on its progress to standard output. .PP Color table types \fIaspect, grey, grey.eq\fR (histogram-equalized grey scale), \fIbyg\fR (blue-yellow-green), \fIbyr\fR (blue-yellow-red), \fIgyr\fR (green-yellow-red), \fIrainbow, ramp, ryg\fR (red-yellow-green), \fIrandom\fR, and \fIwave\fR are pre-defined color tables that \fIr.colors\fR knows how to create without any further input. .PP In general, tables which associate colors with percentages (aspect, bcyr, byg, byr, elevation, grey, gyr, rainbow, ramp, ryb, ryg and wave) can be applied to any data, while those which use absolute values (aspectcolr, curvature, etopo2, evi, ndvi, population, slope, srtm, and terrain) only make sense for data with certain ranges. One can get a rough idea of the applicability of a colour table by reading the corresponding rules file ($GISBASE/etc/colors/). For example the \fIslope\fR rule is defined as: \fC .DS .br 0 255:255:255 .br 2 255:255:0 .br 5 0:255:0 .br 10 0:255 255 .br 15 0:0:255 .br 30 255:0:255 .br 50 255:0:0 .br 90 0:0:0 .br .DE \fR .PP This is designed for the slope map generated by r.slope.aspect, where the value is a slope angle between 0 and 90 degrees. .PP Similarly, the \fIaspectcolr\fR rule: \fC .DS .br 0 white .br 1 yellow .br 90 green .br 180 cyan .br 270 red .br 360 yellow .br .DE \fR .PP is designed for the aspect maps produced by r.slope.aspect, where the value is a heading between 0 and 360 degrees. .PP The \fIrules\fR color table type will cause \fIr.colors\fR to read color table specifications from standard input (stdin) and will build the color table accordingly. .PP Using color table type \fIrules\fR, there are two ways to build a color table: by category values and by "percent" values. .br .br .br .br .br .br .PP To build a color table by category values' indices, the user should determine the range of category values in the raster map layer with which the color table will be used. Specific category values will then be associated with specific colors. Note that a color does not have to be assigned for every valid category value because \fIr.colors\fR will interpolate a color ramp to fill in where color specification rules have been left out. The format of such a specification is as follows: \fC .DS .br category_value color_name .br category_value color_name .br .. .. .br .. .. .br category_value color_name .br end .br .DE \fR .PP Each category value must be valid for the raster map layer, category values must be in ascending order and only use standard GRASS color names (aqua, black, blue, brown, cyan, gray, green, grey, indigo, magenta, orange, purple, red, violet, white, yellow). .PP Colors can also be specified by color numbers each in the range 0-255. The format of a category value color table specification using color numbers instead of color names is as follows: \fC .DS .br category_value red_number:green_number:blue_number .br category_value red_number:green_number:blue_number .br .. .. .. .. .br .. .. .. .. .br category_value red_number:green_number:blue_number .br end .br .DE \fR .PP Specifying a color table by "percent" values allows one to treat a color table as if it were numbered from 0 to 100. The format of a "percent" value color table specification is the same as for a category value color specification, except that the category values are replaced by "percent" values, each from 0-100, in ascending order. The format is as follows: \fC .DS .br percent_value% color_name .br percent_value% color_name .br .. .. .br .. .. .br percent_value% color_name .br end .br .DE \fR .PP Using "percent" value color table specification rules, colors can also be specified by color numbers each in the range 0-255. The format of a percent value color table specification using color numbers instead of color names is as follows: \fC .DS .br percent_value% red_number:green_number:blue_number .br percent_value% red_number:green_number:blue_number .br .. .. .. .. .br .. .. .. .. .br percent_value% red_number:green_number:blue_number .br end .br .DE \fR .PP Note that you can also mix these two methods of color table specification; for example: \fC .DS .br 0 black .br 10% yellow .br 78 blue .br .br .br 100% 0:255:230 .br end .br .DE \fR .PP To set the NULL (no data) color, use the "nv" parameter: \fC .DS .br 0 black .br 10% yellow .br nv white .br end .br .DE \fR .PP To set the color to used for undefined values (beyond the range of the color rules) use the "default" parameter: \fC .DS .br 0 red .br 1 blue .br default grey .br end .br .DE \fR .SH EXAMPLES The below example shows how you can specify colors for a three category map, assigning red to category 1, green to category 2, and blue to category 3. Start by using a text editor to create the following rules specification file (save it with the name \fIrules.file\fR): \fC .DS .br 1 red .br 2 green .br 3 blue .br end .br .DE \fR .PP The color table can then by assigned to map \fIthreecats\fR by the following GRASS commands (two ways are available): \fC .DS .br # read input from stdin .br cat rules.file | r.colors map=threecats color=rules .br .br # read directly from file .br r.colors map=threecats rules=rules.file .br .DE \fR .PP .br To create a natural looking lookup table (LUT) for true map layer \fIelevation\fR, use the following rules specification file. It will assign light green shades to the lower elevations (first 20% of the LUT), and then darker greens (next 15%, and next 20%) and light browns (next 20%) for middle elevations, and darker browns (next 15%) for higher elevations, and finally yellow for the highest peaks (last 10% of LUT). \fC .DS .br 0% 0:230:0 .br 20% 0:160:0 .br 35% 50:130:0 .br 55% 120:100:30 .br 75% 120:130:40 .br 90% 170:160:50 .br 100% 255:255:100 .br .DE \fR .PP .br To invert the current rules: \fC .DS .br r.colors current_raster \-n rast=current_raster .br .DE \fR .SH SEE ALSO \fI d.colors, d.colortable, d.histogram, d.legend, r.colors.stddev, r.support, r.univar, v.colors \fR .PP See also wiki page Color tables (from GRASS User Wiki) .PP ColorBrewer is an online tool designed to help people select good color schemes for maps and other graphics. .SH AUTHORS Michael Shapiro and David Johnson .PP \fILast changed: $Date: 2013-02-15 23:04:18 +0100 (Fri, 15 Feb 2013) $\fR .PP Full index .PP © 2003-2014 GRASS Development Team