[Thread Prev][Thread Next][Index]
Re: Keys for line plots
> I would like to be able to move the key and also change the
> labelling on the keys produced for line plots using the ferret
> command PLOT. Please let me know how this may be done.
Hi Tony -
Here is a rather cumbersome alternative that lets you
put a legend anywhere on the plot. Put the attached
script (legline.go) in your path. Then:
plot/nolab .... your_variables ! /nolab removes the default key
go legline.go x_value x_length y_value line_type char_ht label_text
go legline.go ...
go legline.go ...
... for as many legend lines as you want ...
where the 6 arguments are described at the head of the script below.
This script works best when the y-axis is positive up. The legend
lines will be not quite right for a negative-up axis (e.g. depth).
In that case use the second script below.
The other oddity is that if the label text begins with a number,
then you must specify @sr (or whatever font you are using) first:
go legline.go x_value x_length y_value line_type char_ht "@sr2 EOF pairs"
Billy K
----------------------------------------------------------------
! script 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 (must be in double-quotes for more than one word)
! 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-negaxis.go
\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
! 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_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