subr flowplotr,del,nxin,nyin,sc,asizein
;for plotting displacement grids
;this version has the y axis reversed which is the way our images are
;normally displayed; to do this, the gy vector order is reversed and we
;use the negative of the y offsets
;ck if nx and ny passed
if !narg ge 2 then nx=nxin else nx=512
if !narg ge 3 then ny=nyin else ny=512
if !narg ge 4 then fac=sc else fac=0
if !narg ge 5 then asize=asizein else asize=0.2
;ck if really a del array
if num_dim(del) ne 3 or dimen(del,0) ne 2 then { type,'DELPLOT - input not a-
 displacement array'  return }
nxg=dimen(del,1)	nyg=dimen(del,2)
wx=float(nx)/nxg
wy=float(ny)/nyg
;this is supposed to compute the grid the same way as Stu's programs
gx=indgen(fltarr(nxg,nyg),0)*wx+wx/2.-1
gy=indgen(fltarr(nxg,nyg),1)*wy+wy/2.-1
;scale to the plot window
gx=(gx)*(!wxt-!wxb)/nx + !wxb
gy=(gy)*(!wyt-!wyb)/ny + !wyb
if fac eq 0 then {
fac=wx/(max(sqrt(del(0,*,*)^2+del(1,*,*)^2))) }
;scale fac to window
ty,'fac =',fac
fac=fac*(!wxt-!wxb)/nx
;note mods for reversed y axis (reverse of gy and -del(1,*,*)  )
gy=reverse(gy,1)
lots_of_arrows,gx,gy,del(0,*,*)*fac,-del(1,*,*)*fac,asize
endsubr
