Hi,
 
I would like to create wireframe plots conditional on 2 variables and use 
different
limits for the 3-axes in each plot.  I thought I could do this with subscripts 
and
the panel.wireframe but I haven't been successful.  I am getting this
error "...multiple actual arguments..." so I definitely don't have something  
set up correctly.  Listed below is the code to generate the dataset and my 
attempt 
at creating my plot.  
 
Assistance is greatly appreciated.
Kim
 
# code to generate the data set, runs quickly
n<-c(2,5,10)
p<-2
lims<-c(4.5,2.5,2)
dat<-NULL
for (j in 1:length(n)) {
  f2<-NULL
  f1<-NULL
  i1<-seq(from=-lims[j],to=lims[j],by=0.1)
  W<-as.matrix(expand.grid(w1=i1,w2=i1))
  for (i in 1:nrow(W)) {
    wtw<-t(W[i,])%*%W[i,]
    psi<-(1+W[i,1]^2)/((1+wtw)^((p-1)/2))
    f1i<-gamma((n[j]+1)/2)/(pi^(p/2)*gamma((n[j]+1-p)/2)*(1+wtw)^((n[j]+1)/2))
    f2<-c(f2,f1i/psi)
    f1<-c(f1,f1i)
  }
  dat<-rbind(dat,cbind(W,f1,rep("h1",nrow(W)),rep(n[j],nrow(W))),
              cbind(W,f2,rep("h2",nrow(W)),rep(n[j],nrow(W))))
}
dat<-data.frame(dat)
colnames(dat)<-c("w1","w2","f","h","ss")
dat$w1<-as.numeric(as.character(dat$w1))
dat$w2<-as.numeric(as.character(dat$w2))
dat$f<-as.numeric(as.character(dat$f))
dat$h<-factor(dat$h,levels=c("h1","h2"))
dat$ss<-factor(dat$ss,levels=c("2","5","10"))
 
# my attempt to generate the plot
wireframe(f ~ w1 * w2|ss*h, data=dat, between=list(x=1, y=1), xlab="w1", 
ylab="w2", zlab="",
          shade=TRUE, light.source=c(10,0,10),
          panel=function(x, y, z, subscripts, ...) {
              xlims<-range(dat$w1[subscripts])
              ylims<-range(dat$w2[subscripts])
              zlims<-range(dat$f[subscripts])
              panel.wireframe(x, y, z,s cales=list(arrows=TRUE), xlim=xlims, 
ylim=ylims, zlim=zlims,...)
          },
          subscripts=TRUE
          )
 
# plot without trying to set the axes limits of each plot
wireframe(f ~ w1 * w2|ss * h, data=dat, between=list(x=1,y=1), xlab="w1", 
ylab="w2", zlab="",
          shade=TRUE, light.source=c(10,0,10))

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to