[R] 3D plot

Duncan Murdoch murdoch.duncan at gmail.com
Tue May 14 19:17:25 CEST 2013


On 14/05/2013 1:10 PM, Amir wrote:
> Dear all,
>
>       I need to plot more than one surface in 3D using R.
> I tried with "persp" function, it produce only one surface.
> Could you please help me how can I do it? The X and Y axis are the same
> but I have Z1 and Z2. I want to have both results in one graph.

That's quite hard to do with persp because it needs to plot the segments 
in a certain order.  You can do it in the rgl package using persp3d for 
the first surface, then persp3d( ..., add=TRUE) for the second.   Note 
that persp3d and persp use slightly different conventions for how to 
specify colours; see ?persp3d for details.

Duncan Murdoch



More information about the R-help mailing list