[R] Plotting an ellipse in 3D

2005-09-09 Thread Mike White
I have been using the ellipse function from the car package and the
covariance matrix to draw an ellipse around a group of points to show the
confidence limits.  However, the points are actually represented by 3
variables so rather than plot each pairwise combination of variables in 2D I
would like to plot the 'ellipse' in 3D using the djmrgl package.  Can anyone
offer advice on how I can plot the surface of  a 3D 'ellipse' using the
covariance matrix to define the shape, so that the points inside can also be
seen.

Thanks
Mike White

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Plotting an ellipse in 3D

2005-09-09 Thread Duncan Murdoch
Mike White wrote:
 I have been using the ellipse function from the car package and the
 covariance matrix to draw an ellipse around a group of points to show the
 confidence limits.  However, the points are actually represented by 3
 variables so rather than plot each pairwise combination of variables in 2D I
 would like to plot the 'ellipse' in 3D using the djmrgl package.  Can anyone
 offer advice on how I can plot the surface of  a 3D 'ellipse' using the
 covariance matrix to define the shape, so that the points inside can also be
 seen.

You should use rgl, rather than djmrgl.  It now has most of the same 
functions plus a lot more.

Then you can plot the ellipse as a wireframe or transparent object.  See 
the demo(regression) example for that kind of drawing; demo(shapes3d) 
for ellipses.  (The demo names are from memory, I don't have access to 
it right now.)

Duncan Murdoch

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Plotting an ellipse in 3D

2005-09-09 Thread John Fox
=data.frame(x=0,
z=0, groups=group)), 0,
paste(group,  ), adj=1, color=surface.col[j])
if (residuals){
yy - y[select.obs]
xx - x[select.obs]
zz - z[select.obs]
fitted - fitted(mod)
rgl.lines(as.vector(rbind(xx,xx)),
as.vector(rbind(yy,fitted)), as.vector(rbind(zz,zz)),
col=surface.col[j])
}
}
}
}
}
}
if (revolutions  0) {
for (i in 1:revolutions){
for (angle in seq(1, 360, length=360/speed))
rgl.viewpoint(-angle, fov=fov)
}
}
if (model.summary) return(summaries) else return(invisible(NULL))
}


John Fox
Department of Sociology
McMaster University
Hamilton, Ontario
Canada L8S 4M4
905-525-9140x23604
http://socserv.mcmaster.ca/jfox 
 

 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of Duncan Murdoch
 Sent: Friday, September 09, 2005 8:03 AM
 To: Mike White
 Cc: R-help@stat.math.ethz.ch
 Subject: Re: [R] Plotting an ellipse in 3D
 
 Mike White wrote:
  I have been using the ellipse function from the car package and the 
  covariance matrix to draw an ellipse around a group of 
 points to show 
  the confidence limits.  However, the points are actually 
 represented 
  by 3 variables so rather than plot each pairwise combination of 
  variables in 2D I would like to plot the 'ellipse' in 3D using the 
  djmrgl package.  Can anyone offer advice on how I can plot 
 the surface 
  of  a 3D 'ellipse' using the covariance matrix to define 
 the shape, so 
  that the points inside can also be seen.
 
 You should use rgl, rather than djmrgl.  It now has most of 
 the same functions plus a lot more.
 
 Then you can plot the ellipse as a wireframe or transparent 
 object.  See the demo(regression) example for that kind of 
 drawing; demo(shapes3d) for ellipses.  (The demo names are 
 from memory, I don't have access to it right now.)
 
 Duncan Murdoch
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! 
 http://www.R-project.org/posting-guide.html

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html