O'Reilly logo

MATLAB Graphics and Data Visualization Cookbook by Swapnonil Banerjee, Nivedita Majumdar

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Animation by incremental changes to chart elements

An alternative approach to animation is to continually erase and redraw the objects on the screen, making incremental changes with each redraw. One of the ways to do this is to redefine the XData, YData, ZData, and/or CData plot object properties for every change, then make calls to refreshdata followed by drawnow; or equivalently linking the plot to the data sources, which will cause the plot to be automatically updated each time the source data is changed by implicitly calling refreshdata and drawnow. This alternative approach allows for faster rendering at a finite cost to the rendering accuracy. In this recipe, you will create an animation using this erase and redraw strategy.

Getting ready ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required