Hi Paul, This script is not part of the Ferret distribution. I'm not sure what the author of the script intended to do for positive-down axes. Possibly when it was converted from an older version to this one a mistake crept in for the positive-down case. I think the intent was that the users could send in a negative value for the size of the label and that would trigger the right correction to locate the label on the plot. It uses the symbols that are automatically defined when you draw a plot, such as ($yaxis_min) and ($yaxis_max). Nothing in those symbols tells us whether the plot is positive-down, so the script needs some clue to make an adjustment - and then it needs to draw things in the right places. I've attached a new version of it, which does do that. Here's an example that calls it. Send -0.14 as the label size, which will tell the script to change things so the line is drawn in the right place. yes? use levitus_climatologyAnsley On 11/21/2014 4:13 AM, Steeven Paul
Yerraguntla wrote:
|
\CANCEL MODE verify !-----------------------------------------------------------------------------+ ! Ferret v5.50 scripts E. Vanvyve 19.06.2003 (LM 28.07.2003)| ! | ! MAKE A LEGEND LINE AND ITS LABEL | ! script from Billy Kessler <billy.kessler@xxxxxxxx>, adapted since | ! and again (use of PLOT/VS rather than ALINE) 16-dec-2006 | ! Corrections for the case with vertical positive-down axis | ! Ansley Manke 02-dec-2014 | ! | ! Syntax : go comm $1 $2 $3 $4 $5 $6 | ! $1 = x-value of line starting point (nouser units) | ! $2 = length of line (nouser units) | ! $3 = y-value of line (nouser units) | ! $4 = line type (number 1-19) | ! $5 = text character height (negative for z pos down axes) | ! $6 = label text (in double-quotes if more than 1 word) | ! | ! ------<-$2->------ "$6($5)" [< $3] | ! ^ | ! [$1] | ! | ! ! this one handles either z pos up or down axes | ! | | ! Example: | ! yes? use levitus_climatology | ! yes? plot/x=180/z=0/color=blue/thick/nolab salt | ! yes? go legend_plot_line 1 0.5 1 10 0.14 "Surface salinity, x=180" | ! | ! Example: vertical axis positive downward | ! yes? use levitus_climatology | ! yes? plot/x=240/y=-20/line=8/z=50:2500/nolab salt | ! yes? go legend_plot_line 3 0.5 3.5 8 -.14 "Salinity, x=220,y=20" | ! | !-----------------------------------------------------------------------------+ !LINE : xy coordinates in nouser units !$ppl$yaxis_min : y axis minimum / $ppl$yaxis_max : y axis maximum !$ppl$xaxis_min : x axis minimum / $ppl$xaxis_max : x axis maximum !axis ranges/length ! these are relative to the first x-value of the data ($xaxis_min) ! see comments at the text label below DEFINE SYMBOL xr = `($xaxis_max) - ($xaxis_min)` ! user units DEFINE SYMBOL yr = `($yaxis_max) - ($yaxis_min)` ! user units DEFINE SYMBOL xl = `($ppl$xlen)` !nouser units DEFINE SYMBOL yl = `($ppl$ylen)` !nouser units !space between y-axis and line beginning DEFINE SYMBOL xs = `($xr) / 30` ! ------------------ "$6($5)" [< y1] ! ^ ^ ! [$x1] [$x2] DEFINE SYMBOL x1 = `($xaxis_min) + ($1) * ($xr)/($xl)` DEFINE SYMBOL x2 = `($x1) + ($2) * ($xr)/($xl)` DEFINE SYMBOL y1 = `($yaxis_min) + ($3) * ($yr)/($yl)` ! If argument 5 is negative, the vertical axis is positive downwards. LET letsiz = ABS(($5)) IF `($5) LT 0` THEN \ DEFINE SYMBOL y1 = `($yaxis_max) - ($3) * ($yr)/($yl)` ! use plot/vs rather than aline ppl window,off plot/vs/over/nolab/line=$4 {`($x1)`,`($x2)`},{`($y1)`,`($y1)`} ppl window,on !TEXT : xy coordinates in nouser units ! note that these are relative to the beginning of the plot x-axis ! this is not necessarily the same as ($xaxis_min)! DEFINE SYMBOL tx = `($1) + ($2)+($2)/10` DEFINE SYMBOL ty = `($3)-letsiz/2` !LABEL/[no]user xpos, ypos, center, angle, size text LABEL/nouser ($tx) ($ty) -1 0 `letsiz` ($6) CANCEL SYMBOL xr yr xl yl xs x1 x2 y1 tx ty SET MODE/last verify
Attachment:
example.gif
Description: GIF image