knitrパッケージでのWebGLの利用

## Warning in file(con, "r"): file("") は、open = "w+" と open = "w+b" だけを
## サポートします: 前者を使います

mtcarsの3次元プロット

unnamed_chunk_3snapshot
You must enable Javascript to view this page properly.

unnamed_chunk_4snapshot
You must enable Javascript to view this page properly.

unnamed_chunk_5snapshot
You must enable Javascript to view this page properly.

様々な3次元プロット

plot3d()ではtype引数でプロットの種類を指定できます。pは点(デフォルト)、sは球、lは線、hは垂直線を描画します(図4)。

unnamed_chunk_6snapshot
You must enable Javascript to view this page properly.

unnamed_chunk_7snapshot
You must enable Javascript to view this page properly.

persp3d()により曲面を可視化できます。

x <- y <- seq(-3,3,length.out=100)
xy <- as.matrix(expand.grid(x, y))
z <- mvtnorm::dmvnorm(xy)
persp3d(x, y, z, col = "gray")