login

color.gs

Top / GrADS / script / color.gs

Japanese / English

Name

color - Set color table for drawing.

Synopsis

color
    (min max [int [inttype]] | -levs lev1 lev2 ... | -var var-name)
    [-div value]
    [-gxout gxout-name]
    [-kind string] [-alpha value]
    [-sample] [-xcbar [xcbar-args]]
    [-ret]
    [-verbose | -v]

Description

Set color table for drawing e.g., shading and contour plot. You can set color setting with a combination of color name, RGB, or RGBA values. Transparent color is supported by GrADS 2.1 or later. To show help, simply run "color"

Options

min max [int [inttype]]
Minimum, maximum, interval of variable values, and type of interval for color table. Follow GrADS standard if interval is not specified. inttype may be "linear" (default) or "fact".
-levs lev1 lev2 ...
Levels of variable value for color table.
-var var-name
Name of variable to draw. Minimum, maximum, and interval of variable values for color table are automatically generated following variable.
-div value
When min and max are specified without int, here you can set division number between [min:max]. Default value is "10".
-gxout gxout-name
Name for "set gxout". Default value is "shaded".
-kind string
Color list. Default string is "blue->white->red". See color list for details.
-alpha
Transparency of color. "0" for totally transparent. "255" for totally non-transparent. Default value is "255".
-sample
Draw color table.
-xcbar xcbar-args
Run xcbar.gs to draw color bar (xcbar.gs is necessary).
-ret
Pretend to be script function.
-v | -verbose
Verbose mode.

Color list for "-kind" option

Color list defines orders and weights of colors. It consists of just one color list name or more than one color name, color list name, (R,G,B) and/or (R,G,B,A), which are connected with "->". If the number of levels exceed the number of colors, intermediate color(s) is (are) created by linear interpolation. You can specify "-(n)->" (n: unsigned integer) instead of "->" to connect colors; in this case, the number of intermediate colors between the two colors will become n if possible. If you specify transparency A in (R,G,B,A), it will overwrite value specified in -alpha. Belows are some examples:

"blue->white->red"
Blue, white, and red.
"bluered"
Blue, white, and red (same as the above).
"red->white->blue"
Red, white, and blue.
"purple->blue->white->red->maroon"
Purple, blue, white, red, and maroon.
"purple->blue->(255,255,255)->red->maroon"
Purple, blue, black, red, and maroon.
"white->grainboe"
White and rainbow.
"white-(0)->grainboe"
White and rainbow. Just one level for white.
(127,127,127,0)->(127,127,127,255)"
Gray, more transparent as value decreases.

color list name

color list equivalent color name list
bluered blue->white->red
redblue red->white->blue
rainbow blue->aqua->lime->yellow->red
grainbow (GrADS default rainbow)
revgrainbow (GrADS default rainbow, reversed)

color name


black
navy
darkblue
mediumblue
blue

darkgreen
green
teal
darkcyan
deepskyblue

darkturquoise
mediumspringgreen
lime
springgreen
aqua

cyan
midnightblue
dodgerblue
lightseagreen
forestgreen

seagreen
darkslategray
limegreen
mediumseagreen
turquoise

royalblue
steelblue
darkslateblue
mediumturquoise
indigo

darkolivegreen
cadetblue
cornflowerblue
mediumaquamarine
dimgray

slateblue
olivedrab
slategray
lightslategray
mediumslateblue

lawngreen
chartreuse
aquamarine
maroon
purple

olive
gray
skyblue
lightskyblue
blueviolet

darkred
darkmagenta
saddlebrown
darkseagreen
lightgreen

mediumpurple
darkviolet
palegreen
darkorchid
yellowgreen

sienna
brown
darkgray
lightblue
greenyellow

paleturquoise
lightsteelblue
powderblue
firebrick
darkgoldenrod

mediumorchid
rosybrown
darkkhaki
silver
mediumvioletred

indianred
peru
chocolate
tan
lightgray

thistle
orchid
goldenrod
palevioletred
crimson

gainsboro
plum
burlywood
lightcyan
lavender

darksalmon
violet
palegoldenrod
lightcoral
khaki

aliceblue
honeydew
azure
sandybrown
wheat

beige
whitesmoke
mintcream
ghostwhite
salmon

antiquewhite
linen
lightgoldenrodyellow
oldlace
red

fuchsia
magenta
deeppink
orangered
tomato

hotpink
coral
darkorange
lightsalmon
orange

lightpink
pink
gold
peachpuff
navajowhite

moccasin
bisque
mistyrose
blanchedalmond
papayawhip

lavenderblush
seashell
cornsilk
lemonchiffon
floralwhite

snow
yellow
lightyellow
ivory
white

Examples

(1) Draw t with default colors (blue->white->red) from 230 to 310 by 10.

ga-> open t.ctl
ga-> color 230 310 10
ga-> d t
ga-> cbar

(2) Draw 10hPa u with "lime->white->red" from -50 to 50.

ga-> open u.ctl
ga-> set lev 10
ga-> color -50 50 -kind lime->white->red
ga-> d u
ga-> cbar

(3) Draw contours with "maroon->red->white->blue->purple" from 0 to 5000 with the interval of 500.

ga-> open hgs.ctl
ga-> set gxout contour
ga-> color -gxout contour 0 5000 500 -kind purple->blue->white->red->maroon
ga-> d hgs

(4) Draw shaded hgs with "(R,G,B)=(100,100,100)вк(100,150,0)вк(200,50,150)" from 0 to 5000 divided by 20.

ga-> open hgs.ctl
ga-> color 0 5000 -div 20 -kind (100,100,100)->(100,150,0)->(200,50,150)
ga-> d hgs
ga-> cbarn

(5) Draw 500hPa t with rainbow shadings. max, min, and int are automatically determined according to the variable range.

ga-> open t.ctl
ga-> set lev 500
ga-> color -var t -kind rainbow
ga-> d t
ga-> cbar

(6) Draw only 100, 200, 500, 1000, 2000, and 5000 hgs contours with rainbow color.

ga-> open hgs.ctl
ga-> set lon 60 120
ga-> set lat 0 60
ga-> color -gxout contour -levs 100 200 500 1000 2000 5000
ga-> d hgs

(7) Draw sample colors "red->white"

ga-> color 1 10 -kind red->white -sample

(8) Draw sample colors "red->white" using xcbar.gs

ga-> color 1 10 -kind red->white -xcbar 1 10 0.5 0.7 -edge triangle -line on

(9) Draw sample colors "white->grainbow"

ga-> color 1 30 1 -kind white->grainbow -sample

(10) Draw sample colors "white->grainbow" with only one level for white.

ga-> color 1 30 1 -kind white-(0)->grainbow -sample

(11) Overlay 500hPa u with transparent gray on shaded 500hPa t.

ga-> open t.ctl
ga-> open u.ctl
ga-> set lev 500
ga-> d t
ga-> color -kind (127,127,127,196)->(127,127,127,0)->(127,127,127,196)
ga-> d u

Script source code