lineplot script set vrange and draw legend automatically

Ben-Jei Tsuang btsuang at YAHOO.COM
Fri Nov 18 19:10:30 EST 2005


Dear GrADS user:

Enclosed is a script, which draws lines, sets vrange and creates a legend
automatically. The script is also available at
http://140.120.30.2/~bjtsuang/grads/lineplot.gs

Put the scipt in your $GASCRP directory. Then you can plot variables "v1 v2
.. vn"  and the legend in the same graph with a good layout.

usage:

    lineplot -x X -y Y -h 0|1 -p -s 0|1|2 -v v1 v2 ... vn -l "l1" "l2" ...
"ln"

type "lineplot" will see the help page (enclosed in the bottom).

Ben

Ben-Jei Tsuang, Prof
Nat'l Chung-Hsing Univ.
Dept. of Environmental Engineering

-----------------

lineplot: draw lines, which sets vrange and creates a legend automatically
    lineplot -x X -y Y -h 0|1 -p -s 0|1|2 -v v1 v2 ... vn -l "l1" "l2" ...
"ln"

  parameters:
     -x X       x position of the lenend center on graph (in) (default at
the center of the graph)
     -y Y       y position on graph (in) (default at the bottom of the
graph)
     -h 0|1     1: draw legend horizontally (default); 0: vertically.
     -p         if set, user can click on graphic to place legend.
     -s 0|1|2   0: GrADS default symbol (white_line green_line yellow_line
..)
                1: (symbol white_line green_line ...)(default)
               2: (white_line green_line red_line ...)
     -v v1 v2 ... vn   variables for line plot, the variables can be any
                grads vaild variable without "-", including define variables
     -l "l1" "l2" ... "ln"   legend for each variables, must be double,
e.g., "ERA40" "NCEP2"
  Use lineplot without parameters to get a short discription.
  Function call and switches can be uppercase and lowercase.
  Defaults are 0 and no text.
  If one keyword misses a value, lineplot uses the default for the remaining
values.

 Example calls of lineplot:

    set time jan1980 dec2000
    set x 1
    set y 1
    define diff=p.1-slp.2
    lineplot -v p.1 slp.2 diff -l "ERA40" "NCEP2" "ERA40-NCEP2" -s 2
    lineplot -v ta.3 ta.1 ta.2 -l "obs" "ERA40" "NCEP2" -s 1
    lineplot -v t(lev=1000) t(lev=850) t(lev=700) -l "1000 hPa" "850 hPa"
"700 hPa" -s 2

  to place the legend center at (3 in, 7.8 in) from the left bottom corner
    lineplot -v ta.3 ta.1 -l "obs" "ERA40" -x 3 -y 7.8
  to place the lenged manually
    lineplot -v ta.3 ta.1 -l "obs" "ERA40" -p
  line plot only:
    lineplot -v ta.3 ta.1 -s 2
  legend only:
    lineplot -l "obs" "ERA40" -s 2
  draw legend vertically:
    lineplot -l "obs" "ERA40" -h 0
-------------- next part --------------
A non-text attachment was scrubbed...
Name: lineplot.gs
Type: application/octet-stream
Size: 13127 bytes
Desc: not available
Url : http://gradsusr.org/pipermail/gradsusr/attachments/20051119/718930bc/attachment.obj 


More information about the gradsusr mailing list