3d graphs

This example is from Yihui's response to a stack overflow question.

Need to load the CanvasMatrix library and the hook_webgl code to get 3d graphs to work

has_X11 = Sys.getenv("DISPLAY") != ""
if (has_X11) knit_hooks$set(webgl = hook_webgl)
<script src="https://dl.dropbox.com/u/15335397/misc/CanvasMatrix.js"></script>

point 3d graph

x <- sort(rnorm(1000))
y <- rnorm(1000)
z <- rnorm(1000) + atan2(x, y)
plot3d(x, y, z, col = rainbow(1000))

_3d_pointssnapshot
You must enable Javascript to view this page properly.

spheres 3d graph

open3d()
## [1] 2
spheres3d(x, y, z, col = rainbow(1000))

_3d_spheressnapshot
You must enable Javascript to view this page properly.

Author: Jim Hester Created: 2013 Mar 27 10:54:38 PM Last Modified: 2013 Jun 13 09:18:30 AM