[Thread Prev][Thread Next][Index]

Re: Fwd: [ferret_users] multiple legend



Hi,

I see in your original message that you are running Ferret v6.64.  PLOT/KEY=title was introduced after that version.  If you can, please update your Ferret executable, or even better, install PyFerret.

-Ansley

On 8/7/2019 5:19 PM, Saat Mubarrok wrote:


---------- Forwarded message ---------
From: Saat Mubarrok <saatmubarrok@xxxxxxxxx>
Date: Thu, Aug 8, 2019 at 9:18 AM
Subject: Re: [ferret_users] multiple legend
To: Ansley C. Manke <ansley.b.manke@xxxxxxxx>


Dear Mrs. Ansley,

Thank you for your answer. I tried the example you gave but it has error, the key/title is unknown
 command qualifier. And after I deleted it, the figure showed up but all lines were black.
Is the command only apply for new ferret version? Mine is 6.64.

Best regards,
Saat M.

On Wed, Aug 7, 2019 at 1:52 AM Ansley C. Manke <ansley.b.manke@xxxxxxxx> wrote:

Hi,

The command qualifier PLOT/KEY=title will use the titles from the variables in the legend of a line plot. Try this example

yes? let/title="Line one" _one_ =  3*X+2
yes? let/title= "Line Two" two = X - 1.5
yes? let/title = "Line Three" three =  4*X+3
yes? plot/color/key=title/x=1:100 one, two, three

(I also used PLOT/COLOR there.  This is a fairly recent addition; PLOT/COLOR with no argument will skip black as a color and start with the colored lines.)

For your script, the problem is that you can't nest grave-accent expressions, but you can have a symbol evaluation inside a grave-accent _expression_. Something along these lines should work:

!MAIN: PLOTTING (2)
plot/thick= 1/vlim=25:31:0.2 /color=19 a19
repeat/name=mn/range=1:18 (\
plot/over/thick=1/vlim=25:31:0.2/symbol=`mn`/line=`mn` a`mn`;\
define symbol mn= `mn`;\
go legend `mn` "`a($mn),return=title`" ur;\
ppl plot;\
)

There is yet another option, a new script linekey.jnl, which was just added and is not yet in the PyFerret/Ferret releases. It was mentioned here, https://www.pmel.noaa.gov/maillists/tmap/ferret_users/fu_2019/msg00183.html. I have attached linekey.jnl and test_linekey.jnl which is a demo script that calls it.  This lets you put the legend inside the plot box or outside its edges, and gives control over symbols used in the line samples.

Ansley

On 8/5/2019 6:51 PM, Saat Mubarrok wrote:
Dear community,

I was trying to plot multiple line for seasonal variation from 19 models from different data sets.
But the problem is I cannot put the legend using legend.jnl. I was trying to use two option based on FAQ and resource from internet:

...
!MAIN:CALCULATE SEASONAL VARIATION
repeat/name=mm/range=1:19 (\
let modelid=model[i=`mm`];\
let/title="`modelid`" a`mm`=thetao_sst[d=`mm`,y=5s:10s@ave,x=50e:80e@ave, z=1, gt=month_reg@mod];\
)

!MAIN:PLOTTING (1)
plot/thick=1/vlim=25:31:0.2 a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,a16,a17,a18,a19;\
....

The problem from script above is the legend placed at below the figure and the name of each line is not the model name (modelid) but variable `a1,a2,a3..` instead. I want to put the legend in upper right of figure.
...
!MAIN: PLOTTING (2)
plot/thick= 1/vlim=25:31:0.2 /color=19 a19
repeat/name=mn/range=1:18 (\
plot/over/thick=1/vlim=25:31:0.2/symbol=`mn`/line=`mn` a`mn`;\
go legend `mn` "`a`mn`,return=title`" ur;\
ppl plot;\
)
...

The problem is that:
**ERROR: variable unknown or not in data set: A
go legend 1 "`a`mn`,return=title`" ur
Command file, command group, or REPEAT execution aborted

So my purpose is to put the legend in upper right part and has a model name on it.
Because I am new to ferret, so any other help, lead, and suggestion is much appreciate.
Thank you very much.

NOAA/PMEL TMAP
  FERRET v6.64  
  Linux(gfortran) 2.6.9-89.0.20.ELsmp - 09/16/10
  6-Aug-19 10:50


Saat M.
KIOST



--
Ansley Manke
NOAA/PMEL Science Data Integration Group
7600 Sand Point Way NE
206-526-6246
--
Ansley Manke
NOAA/PMEL Science Data Integration Group
7600 Sand Point Way NE
206-526-6246

[Thread Prev][Thread Next][Index]
Contact Us
Dept of Commerce / NOAA / OAR / PMEL / Ferret

Privacy Policy | Disclaimer | Accessibility Statement