comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Simple animation?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Simple animation? [message #32095 is a reply to message #32090] Wed, 11 September 2002 07:47 Go to previous messageGo to previous message
Liam E. Gumley is currently offline  Liam E. Gumley
Messages: 378
Registered: January 2000
Senior Member
David Fanning wrote:
> Liam E. Gumley (Liam.Gumley@ssec.wisc.edu) writes:
>
>> Shawn wrote:
>>> I recently tried to animate the change in my data with time. I
>>> found that if I plotted to the same window, it would over plot the old
>>> data, which was good, but it also redraws the axis every time as well,
>>> which causes a lot of "flashing". Is it possible to tell IDL to only
>>> redraw the data and to leave the axis alone?
>>
>> Try plotting the first dataset with PLOT, and subsequent datasets with
>> OPLOT.
>
> Well, that wouldn't animate the plot, really. Just
> show more and more data piled on top of it.
>
> Try this. Create a pixmap window the same size
> as your display window. Draw your plots in the
> pixmap window, then use the DEVICE COPY technique
> to copy the contents of the pixmap window to the
> display window. This will result in a flicker-free
> animation. :-)

I initially started writing a reply that included this exact advice. But
on rereading the original post, I thought a simpler solution might be
required.

However as David says, DEVICE COPY will give you true animation. Here's
an example of Brownian motion animation from chapter 5 of my book:

PRO BROWNIAN

;- Create visible window, and initialize plot
xsize = 640
ysize = 512
window, /free, xsize=xsize, ysize=ysize
viswin = !d.window
plot, [0], /nodata, xrange=[-1, 1], yrange=[-1, 1]

;- Create pixmap window, and copy the visible window
window, /free, /pixmap, xsize=xsize, ysize=ysize
pixwin = !d.window
device, copy=[0, 0, xsize, ysize, 0, 0, viswin]

;- Set animation parameters
nframes = 250
npoints = 50
temp = 0.02
seed = -1L
x = randomn(seed, npoints) * 0.1
y = randomn(seed, npoints) * 0.1

;- Create Brownian motion animation in visible window
wset, viswin
for i = 1L, nframes do begin
device, copy=[0, 0, xsize, ysize, 0, 0, pixwin]
plots, x, y, psym=1
x = x + temp * randomn(seed, npoints)
y = y + temp * randomn(seed, npoints)
endfor

END

You can play with the values of NFRAMES, NPOINTS, and TEMP to vary the
length and fluidity of the animation.

Cheers,
Liam.
Practical IDL Programming
http://www.gumley.com/
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: having IDL output to another X11 window
Next Topic: Re: Ascii-import

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Sat Oct 11 22:14:11 PDT 2025

Total time taken to generate the page: 0.87769 seconds