[R] Ploting 3D cylinder in RGL

Duncan Murdoch murdoch at stats.uwo.ca
Thu Dec 18 13:55:17 CET 2008


megh wrote:
> Dear all,
>
> I would like to draw a 3-D horizontal cylinder preferably in RGL device
> (because this gives the look from different angles). Basic idea is from
> http://www.tau.ac.il/cc/pages/docs/sas8/insight/chap18/sect3.htm.
>
> Below is the description exactly what I want to do.
>
> Please see at figure 18.6, 1st plot. Here it is an confidence ellipsoid.
> Suppose now you put another 4 same ellipsoids on top of each. Therefore you
> would get a cylinder type 3-D picture vertically. I do not need to plot
> indiv. points rather just ellipsoids. Also another vertical line which goes
> through the mid-points (i.e. expectation of corresponding BVN).
>
> Same thing I want to do horizontally. Can anyone please give some idea how I
> can do it in RGL device?

There are several ways, but they all involve you calculating the 
coordinates of points on the surface of the cylinder, since rgl has no 
"cylinder" function.  See the examples in ?persp3d, especially example 
4.  (You don't need the radius to vary, a constant radius should work 
for you.)

Duncan Murdoch



More information about the R-help mailing list