Re: [R] Animation for pers3d

From: Duncan Murdoch <murdoch.duncan_at_gmail.com>
Date: Tue, 05 Apr 2011 07:24:48 -0400

On 11-04-05 5:43 AM, Grigory Alexandrovich wrote:
> Hello all,
>
> I use persp3d from the rgl-package to plot a sruface. The typical call
> is persp3d(x, y, z)
> With cooridinate-vectros x, y and a function-values matrix z.
>
> Now I have different z's, say z_1,...,z_n
>
> Question:
>
> Is it possible to generate an animation from a sequence of such calls,
> for different z's?
> I would like to see how the surface is beeing changed in the time.

Yes, you can do animations. See example(persp3d) for one that changes the viewpoint. If you want to change the content of the plot, save the result of persp3d() on the first call, e.g.

objs <- persp3d( ... )
surface <- objs["surface"]

then delete and re-plot the "surface" element:

rgl.pop(id=surface)
# compute new x y z
surface <- surface3d(x, y, z)

If the scale changes during the animation it's likely to look ugly, so set the limits in the persp3d call (or turn off the axes).

Duncan Murdoch



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Tue 05 Apr 2011 - 11:27:13 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 05 Apr 2011 - 12:00:27 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive