oplot for plots [message #49809] |
Fri, 18 August 2006 06:32 |
Nic
Messages: 5 Registered: June 2006
|
Junior Member |
|
|
Hi all!
I am trying to draw 10 arrows randomly placed in the x-y plane to their
z(x,y) value.
Here is what I have tried so far:
PRO IMPULSE_2D
;This procedure produces a 2-D impulse function plot with 10 arrows.
; The number of arrows can be adjusted by the for loop.
; make graphics window plot
; 3-D sin function from p. 271 Practical IDL programming by Gumley
v=findgen(41)*.5-10
x=rebin(v, 41,41, /sample)
y=rebin(transpose(v), 41, 41, /sample)
r=sqrt(x^2+y^2)+1.0e-6
z=sin(r)/r
window, /free
surface, z, title='A 2-D impulse function', xtitle='x', ytitle='y',
charsize=2, /save, /nodata
for i=0, 9 do begin
index1=fix(round(randomu(seed1)*41))
index2=fix(round(randomu(seed2)*41))
plots, [index1,index2,0], [index1,index2,z[index1,index2]], /t3d
print, i
print, index1, index2
endfor
end
It is making lines (how do I get it to plot arrows?), but I think each
time the for loop runs, it is overwriting the previous loop's plots. I
want to overplot each new plots to the original surface plot.
Thanks for any help. (And thank you so much for all that help with the
dirac plot way back when!)
Nic
|
|
|