[Thread Prev][Thread Next][Index]

Re: how to make simple legends



Here are scripts that make legend lines. There are two versions,
the second for negative axes (especially depth). They are not 
exactly bulletproof, but usually work.

Make your plot with the UNLABEL qualifier, then call these scripts
for each line individually. They place the legend lines anywhere
you want. 

I wrote these a long time ago, and if someone could improve on
them please post them to the group. I have no doubt that a more
elegant solution is possible.

Billy K
----------------------------------------------------------------

1. legline.go (basic script for ordinary situations):

\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 double-quotes for multiple words)
! 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

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

2. legline-negaxis.go (for a negative axis (especially depth)):

\can mode verify
! for negative axis (e.g.depth), reverse low/high in definition of txypos
! 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 double-quotes for multiple words)

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_low))-(($ppl$range_high)))/($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

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


[Thread Prev][Thread Next][Index]

Dept of Commerce / NOAA / OAR / PMEL / TMAP

Contact Us | Privacy Policy | Disclaimer | Accessibility Statement