[Thread Prev][Thread Next][Index]

Re: Draw an arrow



I works, thanks for the quick reply.





                                 Adil Sozer
                                 ODTU Deniz Bilimleri Enstitusu
                                 METU Institute of Marine Sciences
         

On Thu, 19 Dec 2002, Mick Spillane wrote:

> 
> 
> |____spillane@pmel.noaa.gov____|
> |__Room 2070 Bldg#3 NOAA/PMEL__|
> |____Phone_:_(206)526-6780_____|
> 
> On Thu, 19 Dec 2002, Adil Sozer wrote:
> > Is it possible to draw an arrow without using the mouse in ferret
> > by giving the start and end points and the direction.
> 
> Dear Adil,
> There are several ways to add arrows to a plot as can be found by
> searching the ferret mail archives
> http://ferret.wrc.noaa.gov/Ferret/Mail_Archives/ferret_mail_archives.html
> 
> Here is a way (that may duplicate something already out there)
> The syntax is
> 	go arrow_user 14 3 4 5 6
> or
> 	go arrow_nouser 19 0 0 8 6
> depending on whether the coordinates are in USER or NOUSER units. In the
> first example a thick red line (pen 14) is drawn from (3,4) to (5,6).
> In the second example a WHITE line (pen 19) is drawn from the lowerleft
> (0",0") to the upperright (8",6") assuming standard axes of 8" by 6".
> 
> The .jnl files are listed below.  Hope they help.
> Mick
> 
> !----------------------------------------------------------------
> ! arrow_user : draws arrow with selected pen given start and end
> !              points in user unit coordinates.  the arrows barb
> !              here is defined as 10% of shaft length at a
> !              constant angle of 30 but these could be modified
> !
> ! usage example:
> !            shade/i=1:8/j=1:6 i+j
> !            go arrow_user 19 3 2 6 5
> !       draws a white arrow (pen 14) with tail at (3,2) and head
> !       at (6,5) where the coordinates are in USER UNITS
> !            let x1=i ; let y1=i ; let x2=1.5*i ; let y2=2*i
> !            repeat/i=1:3 (go arrow_user 14 `x1` `y1` `x2` `y2`)
> !       adds a family of three thick red arrows
> !
> ppl pen,1,$1
> ppl aline,1,$2,$3,$4,$5
> let shaftlen=(($2-$4)^2+($3-$5)^2)^0.5 ! shaft length
> let shaftdir=atan2($3-$5,$2-$4)        ! head to tail direction
> 
> ! barb definition - customize as desired
> let barbang=30*atan(1.)/45             ! 30 degrees converted to radians
> let barblen=0.1*shaftlen               ! barb length set to 10% of shaft
> 
> let barbx1=$4+barblen*cos(shaftdir+barbang) ! right barb tooking toward tip
> let barby1=$5+barblen*sin(shaftdir+barbang)
> let barbx2=$4+barblen*cos(shaftdir-barbang) ! left barb tooking toward tip
> let barby2=$5+barblen*sin(shaftdir-barbang)
> 
> ppl aline,1,$4,$5,`barbx1`,`barby1`
> ppl aline,1,$4,$5,`barbx2`,`barby2`
> 
> !-------------------------------------------------------------
> ! arrow_nouser : draws arrow with selected pen given start and end
> !                points in NONUSER coordinates.  the arrows barb
> !                here is defined as 10% of shaft length at a
> !                constant angle of 30 but these could be modified
> !
> ! usage examples:
> !            shade/i=1:8/j=1:6 i+j
> !            go arrow_nouser 19 0 0 8 6
> !       draws a single white arrow (pen 19) with tail at (0,0) and head
> !       at (8,6) where coordinates are NONUSER (inches by default)
> !            let x1=i ; let y1=i ; let x2=1.5*i ; let y2=2*i
> !            repeat/i=1:3 (go arrow_nouser 14 `x1` `y1` `x2` `y2`)
> !       adds a family of three thick red arrows
> !
> ppl pen,1,$1
> ppl aline/nouser,1,$2,$3,$4,$5
> let shaftlen=(($2-$4)^2+($3-$5)^2)^0.5 ! shaft length
> let shaftdir=atan2($3-$5,$2-$4)        ! head to tail direction
> 
> ! barb definition - customize as desired
> let barbang=30*atan(1.)/45             ! 30 degrees converted to radians
> let barblen=0.1*shaftlen               ! barb length set to 10% of shaft
> 
> let barbx1=$4+barblen*cos(shaftdir+barbang) ! right barb tooking toward tip
> let barby1=$5+barblen*sin(shaftdir+barbang)
> let barbx2=$4+barblen*cos(shaftdir-barbang) ! left barb tooking toward tip
> let barby2=$5+barblen*sin(shaftdir-barbang)
> 
> ppl aline/nouser,1,$4,$5,`barbx1`,`barby1`
> ppl aline/nouser,1,$4,$5,`barbx2`,`barby2`
> 



[Thread Prev][Thread Next][Index]

Dept of Commerce / NOAA / OAR / PMEL / TMAP

Contact Us | Privacy Policy | Disclaimer | Accessibility Statement