1 / 12

Travels in 3D space

Travels in 3D space. Data ellipsoids, biplots, and rgl movies SCS Seminar, Oct., 2008. Prelude. Multivariate data often needs > 2D Usually reduced to multiple 2D views Static 3D visualization often Badly rendered Lacks control of perspective Lacks direct manipulation of viewpoint

zofia
Télécharger la présentation

Travels in 3D space

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Travels in 3D space Data ellipsoids, biplots, and rgl movies SCS Seminar, Oct., 2008

  2. Prelude • Multivariate data often needs > 2D • Usually reduced to multiple 2D views • Static 3D visualization often • Badly rendered • Lacks control of perspective • Lacks direct manipulation of viewpoint • Dynamic 3D visualization • ggobi / rggobi – powerful dynamic graphics, but crummy rendering • rgl – beautiful rendering, good interactive control of perspective, viewpoint, etc., weak 3D “tours” • Goal: Explore 3D vis & animation with rgl

  3. Iris data: rgl:::plot3d() data(iris); library(rgl) col <-c("blue", "green", "red")[iris$Species] plot3d(iris, type="s", size=0.4, col=col, cex=2, box=FALSE, aspect="iso")

  4. Add data ellipse cov <- cov(iris); mu <- mean(iris) plot3d( ellipse3d(cov, centre=mu, level=0.68), col="gray", alpha=0.2, add = TRUE)

  5. Add PC axes source("c:/R/functions/ellipse3d.axes.R") axes <- ellipse3d.axes(cov, centre=mu, level=0.72, labels=TRUE) M1 <- par3d("userMatrix")

  6. Rotate to show PC1 & PC2: Biplot view # hand rotate / zoom, then save current position M2 <- par3d("userMatrix")

  7. Rotate to show PC1 & PC3 M3 <- par3d("userMatrix")

  8. Rotate to show PC2 & PC3 M4 <- par3d("userMatrix")

  9. Biplot movie: rotation to PC coordinates interp <-par3dinterp( userMatrix=list(M1, M2), extrapolate="constant", method="linear") movie3d(interp, duration=4, fps=8, movie="biplot3d-iris")

  10. Grand tour: Interpolation thru multiple views interp3 <-par3dinterp(userMatrix=list(M1, M2, M3, M4, M3, M2, M1), extrapolate="constant", method="linear" ) movie3d(interp3, duration=6, fps=8, movie="biplot3d-iris3", dir="../anim")

  11. View in PCA space: bpca package library(bpca) col <-c("blue","green","red")[iris$Species] plot(bpca(iris[-5], method='hj', lambda.end=3), rgl.use=TRUE, obj.cex=.8, obj.col=col, simple.axes=FALSE, box=TRUE) movie3d(spin3d(), movie="biplot3d-bpca“) movie3d requires ImageMagik: http://www.imagemagik.org

  12. movie3d details • rgl can only write .png files. movie3d() just writes a lot of them • Default: writes duration x fps .png files to the current or dir= directory • Need to figure out how time relates to angular rotation • E.g., spin3d() uses rpm=5, so need duration=12 to get 360o • Calls: convert –delay 1x{fps} movie*.png movie.gif, producing an animated .gif image. • Animated .gif can be viewed as an animation in most browsers (e.g., Firefox) and Powerpoint, but will not animate in many image viewers (IM display, …) or in .pdf files created from PPT (like this one). • Once the frames have been created, you can run convert in a DOS shell with other parameters, or create other movie formats, e.g., mpeg, pdf, ... • LaTeX beamer: I’ve discovered how to run movie3d .gif animations from a beamer .pdf file. The room left on this slide is too small to say how.

More Related