[Thread Prev][Thread Next][Index]
Re: legends in ferret
I have written some simple scripts that draw legend lines and text
anywhere on a plot. They are attached below. Three are available:
legline.go basic script to make legend lines
legline-zdown.go handles plots where the y-axis is positive down
legline-nu.go entry of legend position in nouser units
What you do is call the script once for each legend line wanted.
Each script takes 6 arguments as listed at the top of the files.
I must say I have had trouble with the nouser one; this is due
to ppl aline/nouser being flaky.
Billy K
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
William S. Kessler
NOAA / Pacific Marine Environmental Laboratory
7600 Sand Point Way NE
Seattle Wa 98115 USA
Tel: 206-526-6221 o__ ____
Fax: 206-526-6744 _,>/'_ -----
E-mail: kessler@pmel.noaa.gov (_) \(_) ------
Home page: http://www.pmel.noaa.gov/~kessler
----------------------------------------------------------------------
!legline.go
\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
! 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
----------------------------------------------------------------------
!legline-zdown.go
\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 (negative for z pos down axes)
! arg6=label text
! This one handles either z pos up or down axes
let/q cht1 = if ($5) gt 0 then ($5) else ($5)*(-1) ! adjust for z pos down axes
define symbol cht2 `cht1`
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 ($cht2) $6
set mode/last verify
----------------------------------------------------------------------
!legline-nu.go
\can mode verify
! make a legend line and its label.
! arg1=x-value of line starting point (nouser units)
! arg2=length of line (nouser units)
! arg3=y-value of line
! arg4=line type (number 1-19)
! arg5=text character height (negative for z pos down axes)
! arg6=label text
! This one handles either z pos up or down axes
let/q cht1 = if ($5) gt 0 then ($5) else ($5)*(-1) ! allow z pos down axes
define symbol cht2 `cht1`
define symbol xend `$1+$2` ! end of line
define symbol txstart `($xend)+$2/10` ! start of text
define symbol drop `$5/2` ! half char hgt in inches
ppl pen,77,$4 ! pen for dummy line number (not to interfere)
ppl aline/nouser 77 $1 $3 ($xend) $3 ! draw line
define symbol txypos `($3)-(($drop))` ! text y-position
label/nouser ($txstart) ($txypos) -1 0 ($cht2) $6 ! label
set mode/last verify
----------------------------------------------------------------------
[Thread Prev][Thread Next][Index]
Dept of Commerce /
NOAA /
OAR /
PMEL /
TMAP
Contact Us | Privacy Policy | Disclaimer | Accessibility Statement