#Example 1: View of a mixture of three tri-variate normal densities
nmix3 <- function(x, y, z, m, s) {
0.4 * dnorm(x, m, s) * dnorm(y, m, s) * dnorm(z, m, s) +
0.3 * dnorm(x, -m, s) * dnorm(y, -m, s) * dnorm(z, -m, s) +
0.3 * dnorm(x, m, s) * dnorm(y, -1.5 * m, s) * dnorm(z, m, s)
}
x<-seq(-2, 2, len=40)
g<-expand.grid(x = x, y = x, z = x)
v<-array(nmix3(g$x,g$y,g$z, .5,.5), c(40,40,40))
slices3d(v,col=heat.colors(256))
#Example 2: View of FMRI data.
library(AnalyzeFMRI)
a<-f.read.analyze.volume(system.file("example.img", package="AnalyzeFMRI"))
slices3d(aperm(a))
Run the code above in your browser using DataLab