[Thread Prev][Thread Next][Index]

Re: legend script



Here are a couple of other legend scripts I've written
over the years. They are more general than Heine's, in 
writing individual legend lines and titles anywhere on 
the plot. They are not bulletproof, and have problems 
especially with negative z axes and time axes, or anyplace 
where PPL ALINE has a problem (which is not infrequent).

Call these scripts, once for each line wanted, after 
having made the plot:

plot var1,var2,var2
go legline.go X XLEN Y 1 CHAR_HEIGHT "Label text 1"
go legline.go X XLEN Y 2 CHAR_HEIGHT "Label text 2"
go legline.go X XLEN Y 3 CHAR_HEIGHT "Label text 3"

Improvements are welcome.

Billy K
----------------------------------------------------------
! Script legline.go is the simplest. Try it first.
\can mode verify
! make a legend line and its label
! arg1=x-value of line starting point (user units)
! arg2=length of line (user units)
! arg3=y-value of line
! arg4=line type (number 1-19)
! arg5=text character height
! arg6=label text (in quotes if a space is included)
! only gets label position right for positive-up axes

define symbol xend `$1+$2`
define symbol txstart `($xend)+$2/10`
ppl %range ($ppl$ymin1) ($ppl$ymax1) 10		! get axis range user units
define symbol drop `$5/2`			! half char hgt in inches
define symbol txypos `($3)-(($drop))*((($ppl$range_high))-(($ppl$range_low)))/($ppl$ylen)`
! set pen for a dummy line number (not to interfere)
ppl pen,77,$4
ppl aline 77 $1 $3 ($xend) $3 
label ($txstart) ($txypos) -1 0 $5 $6
set mode/last verify
----------------------------------------------------------
! script legline-nu.go is for nouser units. 
\can mode verify
! make a legend line and its label (nouser units) (Vanvyve e-mails 25 July 2003)
! calls user-unit legline script, after converting to user units

! arg1=x-value of line starting point (fraction of plot width)
! arg2=length of line (fraction of plot width)
! arg3=y-value of line (fraction of plot height)
! arg4=line type (number 1-19)
! arg5=text character height
! arg6=label text (in quotes if a space is included)
! only gets label position right for positive-up axes

let xrange `($xaxis_max) - ($xaxis_min)`
let yrange `($yaxis_max) - (($yaxis_min))`
let leg1 `($xaxis_min) + xrange*$1`
let leg2 `xrange*$2`
let leg3 `($yaxis_min) + yrange*$3`

go legline.go `leg1` `leg2` `leg3` $4 $5 "$6"

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




[Thread Prev][Thread Next][Index]

Dept of Commerce / NOAA / OAR / PMEL / TMAP

Contact Us | Privacy Policy | Disclaimer | Accessibility Statement