[Thread Prev][Thread Next][Index]

Re: [ferret_users] how to put symbol in legend



Dear Ansley,
G'day
Thanks for your reply. It is partially working. so the problem that I am facing to use that script is that....

(1) I can not put a title "BRB" of the legend of grey diamond boxes.
(2) I can not set the positing of the legend other then ul,ur .....etc.
(3) I can not maintain the same opacity and thickness of the symbols used in plot and the in legend.

I believe you can have some more ideas on this. I am showing the script that tell what I am trying to do.

Cheers

go multi_view 3,2,.43,0.085,0.025,.21,.07,0.12,a

set window/aspect=0.45:axis 1

cancel data/all
cancel data/all

use "/media/srathore/Binny/data/var1.nc"

set viewport a11

plot/thick=3/axes/set/nolab/nokey/col=1 var1[x=150E:210E@ave,y=10S:10N@ave,t=16-jan-1972:16-dec-1974]
ppl axlsze .18,.18
ppl txlsze .17
ppl tics .0,.1,.0,.1,1,1
ppl txlint,2,1
ppl axlabp,-1,-1
ppl plot

cancel data/all
cancel data/all

use "/media/srathore/Binny/data/var2.nc"

plot/ov/thick=3/noaxes/nolab/nokey/col=2 var2[x=150E:210E@ave,y=10S:10N@ave,t=16-jan-1972:16-dec-1974]
ppl plot/ov

cancel data/all
cancel data/all

use "/media/srathore/Binny/data/var3.nc"

plot/ov/thick=3/noaxes/nolab/nokey/col=4/opacity=70 var3[x=110E:155E@ave,y=45S:10S@ave,t=16-jan-1972:16-dec-1974]
plot/thick=2/ov/noaxes/nolab/nokey/col=1/opacity=45/sym=29/size=.6 var3[x=141E:155E@ave,y=29S:10S@ave,t=16-jan-1972:16-dec-1974]

go margins 1.4  1.4  1.2  1.2
go linekey.jnl 1 "BRB" plot/sym=29/size=.6/color=black/opacity=30/thick ul
ppl plot/ov

exit

On Wed, May 22, 2019 at 6:21 PM Ansley C. Manke <ansley.b.manke@xxxxxxxx> wrote:

Hi,

This is something we've planned to add for a long time: more flexibility to the legend-line plotting.  "go legend"  and "go legline" cannot do it; they both use an old capability called "aline" which can only draw lines based on the default line-type numbers, with line 1 always drawn as a thin black line, line 2 a thin red line, and so forth.

Please try the attached script "linekey.jnl".  It is somewhat similar to "legend.jnl" in that it adds one line to the legend, but it lets you pass in the plot qualifiers you want to use.  It will also allow the legend to be placed outside the plot box. Read the comments at the start of the script for some details.  Note that this is new and has not been heavily tested - it accounts for the aspect ratio of the plot in positioning and spacing the legend lines, but it may need some adjustments.  It will be part of future Ferret/PyFerret releases.

The script "test_linekey.jnl" also attached, does a few examples.  Here is a short example of how it looks,  making a couple of line plots and a legend in the lower left.  The arguments are

  • line number in the legend
  • title to use in the legend
  • plot command with qualifiers for this legend line
  • location: ll, lr, ul, ur  as in "legend.jnl"  or   llc, lrc, ulc, urc referring to the corners of the plot window, lower-left-corner and so forth.


! simple example calling the linekey.jnl script

yes? cancel mode logo

yes? go margins 1.4  1.4  1.2  1.2

yes? plot/nolab/i=1:60/thick/sym=20/color=blue cos(i/7)
yes? plot/over/nolab/i=1:60/thick/size=0.16/line/sym=30/color=red sin(i/10)

yes? go linekey 1 "line 1" plot/thick/sym=20/color=blue llc
yes? go linekey 2 "line 2" plot/thick/size=0.16/line/sym=30/color=red llc

yes? frame/file=example_linekey.png



On 5/22/2019 5:17 AM, saurabh rathore wrote:
Dear Ferreters,
G'day

I am trying to put a legend to my plot in which i used symbol (sym=29). I am trying to put that symbol as my legend but I am unable to do so. here is my code.

use "/media/srathore/Binny/data/rain/mine/noaa_prel/precip_calender.nc"

plot/ov/thick=3/noaxes/nolab/nokey/col=4/opacity=70 precip[x=110E:155E@ave,y=45S:10S@ave,t=16-jan-1972:16-dec-1974]/precip[x=110E:155E@ave,y=45S:10S@ave,t=16-jan-1972:16-dec-1974@std]
plot/thick=2/ov/noaxes/nolab/nokey/col=1/opacity=30/sym=29/size=.6 precip[x=141E:155E@ave,y=29S:10S@ave,t=16-jan-1972:16-dec-1974]/precip[x=141E:155E@ave,y=29S:10S@ave,t=16-jan-1972:16-dec-1974@std]

!plot/ov/nolab/col=1/thick=2/opacity=30/sym=29 12,4
!go legend 5 rain-Qld

ppl plot/ov

So how to put this symbol as a legend on my desired location, with my choice of color, thickness, opacity and size ?

cheers, saurabh

--


REGARDS

Saurabh Rathore
Research Scholar (PhD.)
Centre For Oceans, Rivers, Atmosphere & Land Science Technology
Indian Institute Of Technology, Kharagpur
contact :- 91- 8345984434
--
Ansley Manke
NOAA/PMEL Science Data Integration Group
7600 Sand Point Way NE
206-526-6246


--


REGARDS

Saurabh Rathore
Research Scholar (PhD.)
Centre For Oceans, Rivers, Atmosphere & Land Science Technology
Indian Institute Of Technology, Kharagpur
contact :- 91- 8345984434

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

Privacy Policy | Disclaimer | Accessibility Statement