[R] persp/ scatterplot3d

Mark Hempelmann e.rehak at t-online.de
Wed Jun 28 14:55:35 CEST 2006


Dear WizaRds,

    I would like to create a 3d-plot with persp(). I sampled 17 points 
with xyz-coordinates (real-life example!), representing the peaks of the 
whole plane with "zero coordinates" x=3,y=3,z=3. My intention is to show 
which entries are above or below the "zero" level with persp() on a 
nicely created grid. I also tried scatterplot3d(), but, alas, I am 
unable to tell the function that my points represent the peaks of the 
plane and are either above or below "normal" (whatever that means...) 
Please help me:

dat<-matrix(c(1.33,1.00,2.67,4.33,4.00,5.00,0.67,3.33,1.00,3.00,3.00,1.33,1.67,1.67,1.33,1.67,2.33,1.67,0.67,1.00,1.33,3.33,2.67,1.67,1.67,2.67,2.00,0.33,0.67,0.33,2.67,3.33,0.67,0.67,1.33,0.00,4.33,3.33,4.67,3.00,4.00,5.00,4.00,3.67,1.67,3.00,3.67,3.33,1.00,1.33,0.33), 
ncol=3)
colnames(dat)<-c("x","y","z")

x=dat$x; y=dat$y, z=dat$z
persp(x,y,z) #   doesn't work at all, of course, even if I utilize outer()

scatterplot3d(x,y,z) #   returns a 3d scatterplot, but not the way I 
would like to see it fit.


Thank you so much for your help and support!


mark



More information about the R-help mailing list