Re: arrows

From: Mary Haley (haley@XXXXXX)
Date: Fri Jul 13 2001 - 10:47:36 MDT


>
> Hi there,
>
> I was wondering if it is possible to use say gsn_polyline to draw an
> arrow.
>
> that is, is it possible to put an arrowhead on the end of a line?
>
> thanks,
> jason

Hi Jason,

It is not possible to draw arrows using gsn_polyline, other than
drawing each individual edge.

However, you can use the function "wmlabs" which is part of the
weather map package that allows you to draw all kinds of weather
symbols, arrows included. I'll include a short sample script
below. Here's the URL for the documentation for wmlabs:

  http://ngwww.ucar.edu/ngdoc/ng/ref/ncl/functions/wmlabs.html

--Mary

load "$NCARG_ROOT/lib/ncarg/nclex/gsun/gsn_code.ncl"

begin

;
; Define a color map and create an X11 workstation.
;
  cmap = (/ \
            (/ 1., 1., 1. /), \ ; color index 0 - white
            (/ 0., 0., 0. /), \ ; color index 1 - black
            (/ 1., 1., 0. /), \ ; color index 2 - yellow
            (/ 0., 0., 1. /) \ ; color index 3 - blue
         /)
  wks = gsn_open_wks("x11","arrow")

  gsn_define_colormap(wks,cmap)

;
; Create arrays to hold random arrow positions.
;
  nums = 200

  x = new(nums,float)
  y = new(nums,float)
  s = new(nums,float)
;
; Draw some arrows at random positions and with random sizes
; and directions.
;
   wmsetp("awc",2) ; arrow color
   wmsetp("aoc",3) ; outline color
   do i=0,nums/2
     x(i) = rand()/32767.
     y(i) = rand()/32767.
     deg = 360.*rand()/32767.
     size = 0.1*rand()/32767.
     wmsetp("ard",deg) ; random direction
     wmsetp("ars",size) ; random size
     wmlabs(wks, x(i), y(i), "arrow") ; Draw arrows.
  end do

  frame(wks) ; Advance the frame.
end



This archive was generated by hypermail 2b29 : Tue Feb 19 2002 - 09:06:05 MST