jmpamao提供的程序
require(scatterplot3d)
x1 <-1;x2 <-2;x3 <-3
n <- 10000
y1 <-rnorm(n,0,x1)
y2 <-rnorm(n,0,x2)
y3 <-rnorm(n,0,x3)
x <-c(rep(x1,n),rep(x2,n),rep(x3,n))
y <- c(y1,y2,y3)
z <-c(dnorm(y1,0,x1),dnorm(y2,0,x2),dnorm(y3,0,x3))
ma.dat <- data.frame(x=x,y=y,z=z)
var3d <- scatterplot3d(ma.dat,type="p",lwd=2,pch=46 ,box=F,x.ticklabs=c(1,NA,2,NA,3),scale.y=1)
#均值时的,概念密度函数值
var3d$points3d(c(1,2,3),c(0,0,0),c(1/sqrt(2*pi),1/(2*sqrt(2*pi)),1/(3*sqrt(2*pi))),col="blue",type="h",pch=" ")
#平行X,y为均值,z为无限接近0的线
var3d$points3d(c(1,2,3),c(0,0,0),c(0,0,0),col="blue",type="l",pch=" ") |