[Thread Prev][Thread Next][Index]

Re: labelling ...



Here is a routine that makes legend lines wherever you
want them to be, saying whatever you want:
-----------------------------------------------------------------------
\can mode verify
! script legline.go
! 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 if more than 1 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
-----------------------------------------------------------------------

Notes:

* Call this routine once for each legend line you want,
  specifying its position each time.
* The routine is not bulletproof! Positive-down axes (depth)
  fool it, for example. (I have another script for that situation).
* The need to work in user units can be a pain if one of the
  axes is time. Typically in Ferret those units are hours, 
  which is not the way we usually think of time. In that case, 
  use the ppl command:

PPL LIST TAXIS

  Then note the value of TSTART relative to the actual start of your 
  plot axis. Then compute time in hours, where TSTART gives hour zero.
  Very often TSTART is one year before the start of a plot if the
  time range is not specified. Some experimentation may be required!

For example, for a plot I am making of data that begins on 3-jan-1979,
PPL LIST TAXIS shows: TSTART=19771231115734 11:57 DEC 31,1977.

To make a red legend line, that starts at the left edge of the plot, 
has length of 1.5 years, is situated at a y-axis-value of -230, with 
text height .16 inches in the "triplex roman" font, I might try:

yes? go legline.go `24*365.24` `24*365.24*1.5` -230 2 .16 "@trA legend line" 

A minor note is that if your legend text begins with a number, you
MUST specify the font: e.g. "@sp1 cycle year^-^1"

Billy K


[Thread Prev][Thread Next][Index]

Dept of Commerce / NOAA / OAR / PMEL / TMAP

Contact Us | Privacy Policy | Disclaimer | Accessibility Statement