Re: [R] Animation for pers3d

From: Duncan Murdoch <>
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:

# 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 mailing list PLEASE do read the posting guide 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 Please read the posting guide before posting to the list.

list of date sections of archive