Dear List,

I have the code below adapted from the lattice-package examples to draw two 
spheres. I would now like to give
both different surface colors, e.g. one red and one blue. 

 ## 3-D surface parametrized on a 2-D grid
                                         
                         n <- 10
                        
                         tx <- matrix(seq(-pi, pi, length.out = 2*n), 2*n, n)
                         ty <- matrix(seq(-pi, pi, length.out = n) / 2, 2*n, n, 
byrow = T)
                         xx <- cos(tx) * cos(ty)
                         yy <- sin(tx) * cos(ty)
                         zz <- sin(ty)
                         zzz <- zz
                         
                         bxx <- xx+5 
                         byy <- yy+5
                         bzzz <- zzz+5
                         
                         xx=rbind(xx,rep(NA,n),bxx)
                         yy=rbind(yy,rep(NA,n),byy)
                         zzz=rbind(zzz,rep(NA,n),bzzz)
                         gr<-rbind(matrix(1,n,2*n),rep(NA,n),matrix(2,n,2*n))
                        
                         wireframe(zzz ~ xx + yy, 
groups=gr,col.groups=c("red","blue"))

I tried various parameters as col.groups, col.regions but I have the impression 
that the "groups" argument in the wireframe command can only be used when 
supplying a data argument, which does not allow to plot the spheres as far as I 
tried. Is there a solution for this?

Cheers

David Schellenberger
______________________________________________
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