xcbar.gs
Name
xcbar - Draw color bar at any position and size.
Synopsis
xcbar [ xmin xmax ymin ymax ] [ ( -xoffset | -xo ) xoffset ] [ ( -yoffset | -yo ) yoffset ] [ ( -fwidth | -fw ) fwidth ] [ ( -fheight | -fh ) fheight ] [ ( -fthickness | -ft ) fthickness ] [ ( -fskip | -fstep | -fs ) fskip ] [ ( -foffset | -fo ) ( foffset | center ) ] [ ( -fcolor | -fc ) fcolor ] [ ( -fxoffset | -fx ) fxoffset ] [ ( -fyoffset | -fy ) fyoffset ] [ ( -fformat | -ffmt ) fformat ] [ -edge ( box | triangle | circle ) ] [ ( -direction | -dir | -d ) ( horizontal | h | vertical | v ) ] [ -line [ on | off] ] [ ( -linecolor | -lc ) linecolor ] [ -levcol c(1) l(1) c(2) level(2) ... l(cnum-1) c(cnum) ] [ ( -caption | -c ) caption... ]
Description
Note that without xmin, xmax, ymin or ymax, position will be determined automatically following cbar.gs manner. To show help, simply run "xcbar".
Options
- xmin
- Color bar position (left side).
- xmax
- Color bar position (right side).
- ymin
- Color bar position (bottom side).
- ymax
- Color bar position (top side).
- ( -xoffset | -xo ) xoffset
- X-direction offset for a color bar position. Default value is 0.
- ( -yoffset | -yo ) yoffset
- Y-direction offset for a color bar position. Default value is 0.
- ( -fwidth | -fw ) fwidth
- Font width. Default value is 0.12.
- ( -fheight | -fh ) fheight
- Font height. Default value is 0.13.
- ( -fthickness | -ft ) fthickness
- Font thickness. Default value is height*40.
- ( -fskip | -fstep | -fs ) fstep
- Label step (interval). Default value is 1.
- ( -foffset | -fo ) ( foffset | center )
- Label start value (=0: minimum value). To put labels at the center, specify "center". Default value is offset=0.
- ( -fcolor | -fc ) fcolor
- Label color. Default value is 1.
- ( -fxoffset | -fx ) fxoffset
- X-direction offset for a label. Default value is 0.
- ( -fyoffset | -fy ) fyoffset
- Y-direction offset for a label. Default value is 0.
- ( -fformat | -ffmt ) fformat
- Format for the label. Default value is none.
- -edge ( box | triangle | circle )
- Shape of edge. Default value is "box".
- ( -direction | -dir | -d ) ( horizontal | h | vertical | v )
- Horizontal ("h" in short) of vertical ("v" in short) color bar. Default value is "horizontal".
- -line [ on | off]
- Lines between each color box. Default value is "on".
- ( -linecolor | -lc ) linecolor
- Color of lines. Default value is 1.
- -levcol c(1) l(1) c(2) level(2) ... l(cnum-1) c(cnum)
- Color numbers and levels. By using this option, you can draw color bar without drawing figure.
- ( -caption | -c ) caption...
- Caption. All the arguments after this is regarded as caption.
Examples
(1) Draw color bar at 1.5<=x<=9.5, 0.5<=y<=0.7.
ga-> open t.ctl ga-> set gxout shaded ga-> d t ga-> xcbar 1.5 9.5 0.5 0.7
(2) Draw color bar at 9.5<=x<=9.7, 1.5<=y<=7.0.
ga-> open ps.ctl ga-> set lat 20 60 ga-> set lon 120 160 ga-> set gxout shaded ga-> d ps ga-> xcbar 9.5 9.7 1.5 7.0
- Normally, you don't have to specify -direction explicitly, since whether horizontal or vertical is determined from position of the color bar.
(3) Draw color bar with lines between and around each color and with its edge circle.
ga-> open u.ctl ga-> set gxout shaded ga-> set lev 500 ga-> d u ga-> xcbar -line on -edge circle
- Color bar position is automatically determined without being specified.
(4) Draw color bar at 1<=x<=10, 0.7<=y<=0.9 with font width=0.15, font height=0.18, and its edge triangle.
ga-> open t.ctl ga-> set gxout shaded ga-> set z 3 ga-> d t-273.15 ga-> xcbar 1 10 0.7 0.9 -fw 0.15 -fh 0.18 -edge triangle
(5) In addition to the examples (2), set the label interval to 2 and shift the first label by 1.
ga-> open t.ctl ga-> set gxout shaded ga-> set z 3 ga-> d t-273.15 ga-> xcbar 1 10 0.7 0.9 -fw 0.15 -fh 0.18 -edge triangle -fs 2 -fo 1
(6) Draw color bar without drawing figure.
ga-> xcbar 2 9 0.3 0.5 -levcol 1 -50 2 -40 3 -30 4 -20 5 -10 6 0 7 -line on
Script source code
- xcbar.gs (necessary)