Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado
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. Cheers, Liam. Practical IDL Programming http://www.gumley.com/
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. :-) Cheers, David -- David W. Fanning, Ph.D. Fanning Software Consulting, Inc. Phone: 970-221-0438, E-mail: david@dfanning.com Coyote's Guide to IDL Programming: http://www.dfanning.com/ Toll-Free IDL Book Orders: 1-888-461-0155
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/
Shawn wrote: > Hello, > 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? > Thanks, > Shawn Dear Shawn, if you have a look at this example from our idl exercises http://www.fz-juelich.de/vislab/idl-beispiele/Darstellung/An imation/bar_go.pro The full link is http://www.fz-juelich.de/vislab/software/idl_samples/IDL-Bei spielsammlung.html Follow IDL-Beispielsammlung->Darstellung->Animation This examples show in different to pixmap which is described by Liam the usage of displaying a series of images stored in a 3-d Array. Device copy and pixmap is the fastest way but there is a limitation of 128 possible pixmap windows. regards Reimar -- Reimar Bauer Institut fuer Stratosphaerische Chemie (ICG-I) Forschungszentrum Juelich email: R.Bauer@fz-juelich.de ------------------------------------------------------------ ------- a IDL library at ForschungsZentrum Juelich http://www.fz-juelich.de/icg/icg-i/idl_icglib/idl_lib_intro. html ============================================================ =======
Reimar Bauer (R.Bauer@fz-juelich.de) writes: > This examples show in different to pixmap which is described by Liam the > usage of displaying a series of images stored in a 3-d Array. > Device copy and pixmap is the fastest way but there is a limitation of > 128 possible pixmap windows. Uh, I think Liam's example uses *one* pixmap window. :-) Cheers, David -- David W. Fanning, Ph.D. Fanning Software Consulting, Inc. Phone: 970-221-0438, E-mail: david@dfanning.com Coyote's Guide to IDL Programming: http://www.dfanning.com/ Toll-Free IDL Book Orders: 1-888-461-0155
On Wed, 11 Sep 2002 07:47:49 -0700, Liam E. Gumley wrote: > 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: > > Liam: I was interested to see that you don't use true double buffering, but instead are just "erasing" the plot axes using the pixmap version of the dataless plot. For such a simple example, this gets the job done (in fact, just using erase & plot, [0], /nodata, xrange=[-1, 1], yrange=[-1, 1] would also do it about as well, except the axes would flicker a bit more). However, if you had a much more complicated plot, or a multiple command plot sequence, the plot drawing commands would themselves cause flicker and lag. This is especially noticeable if driven by motion events. In that case, it pays to use double buffering, i.e. draw *everything* to a pixmap, and, when finished, copy over to the visible window in one go. This produces by far the smoothest animation and motion for multi-element plots. It would go something like: wset,pixwin plot,... countour,..,/noerase oplot,..... tv,...,/noerase wset,viswin device,copy=[0, 0, xsize, ysize, 0, 0, pixwin] Obviously, if you can avoid redrawing certain things by offloading them to another pixmap and zapping that into the double-buffer pixmap, you can increase frame rates, but I find this simple technique excels for even very complicated plots. JD
How about a 2 s download and two lines of code: IDL> display, findgen(100), name='this' IDL> for i =1, 100 do display, sin(findgen(100)/(1000./i)), name='this', /over http://www.ainaco.com/idl/idl_library/display.pro Cheers, Pavel Shawn wrote: > > Hello, > 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? > Thanks, > Shawn
Thank you David and Liam! I found both of your answers useful. I am going to keep David's answer in my back pocket until I decide to take the time to learn how to use pixmap windows. I used Liam's idea, modified of course, but it worked. I made the first plot, using "plot", then succesive plots were done using oplot in a 2 step fashion. First I overplotted the previous plot with the background color, then plotted the next array using the forground color. Not very elegant, but simple, and it was fast enough that I had to put wait statements in to slow the animation down. Thanks again, Shawn David Fanning <david@dfanning.com> wrote in message news:<MPG.17e860152c7ca76e9899a5@news.frii.com>... > 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. :-) > > Cheers, > > David
David Fanning wrote: > Reimar Bauer (R.Bauer@fz-juelich.de) writes: > >> This examples show in different to pixmap which is described by Liam the >> usage of displaying a series of images stored in a 3-d Array. >> Device copy and pixmap is the fastest way but there is a limitation of >> 128 possible pixmap windows. > > Uh, I think Liam's example uses *one* pixmap window. :-) Oh, I should read more carefully. Reimar -- Forschungszentrum Juelich email: R.Bauer@fz-juelich.de http://www.fz-juelich.de/icg/icg-i/ ============================================================ ====== a IDL library at ForschungsZentrum Juelich http://www.fz-juelich.de/icg/icg-i/idl_icglib/idl_lib_intro. html