Hello R-classicist won't like the following question due to there's no minimal reproducible example and the question was posted already. Anyway I'm not able understand this rather complicated version of "add points to wireframe". what I have is matrix 3x2000 with a dem<-(x,y,z, coordinates) (not provided). with follwing code I want to produce the wireframe and add some points on it: wireframe(z ~ x * y, data=dem, aspect = c(1, .5), scales = list(arrows = FALSE), panel.3d.wireframe = function(x, y, z,...) { panel.3dwire(x = x, y = y, z = z, ...) panel.3dscatter(x = x, y = y, z = z, data=ramm ...) }) 3d.scatter should give me the points into the wireframe from ramm:> rammx y z 1 10.179 7.999 9.069 2 10.988 15.982 13.682 3 10.765 23.155 16.995 4 -0.577 24.275 17.171 5 10.430 32.677 19.488 6 16.725 25.301 17.211 7 15.248 16.440 13.638 8 -0.841 17.577 14.007 9 -0.379 9.401 9.578 10 19.560 6.905 8.212 11 23.288 1.783 5.974 12 9.681 1.096 5.889 13 -0.001 2.127 5.991 somehow there are errors appearing: Fehler: syntax error, unexpected SYMBOL, expecting ',' in: " y = y, in plot, the wireframe appears, but no axes and points. thanks for your help marc -- Psssst! Schon vom neuen GMX MultiMessenger geh?rt? Der kanns mit allen: http://www.gmx.net/de/go/multimessenger
marcg wrote:> > Hello > > with follwing code I want to produce the wireframe and add some points on > it: > > wireframe(z ~ x * y, data=dem, aspect = c(1, .5), > scales = list(arrows = FALSE), > panel.3d.wireframe = function(x, y, z,...) { > panel.3dwire(x = x, y = y, z = z, ...) > panel.3dscatter(x = x, > y = y, > z = z, data=ramm > ...) > }) > >You're missing a comma after data=ramm ... But even when I fix that, I don't get what you want -- I don't the data argument gets used here. xy <- expand.grid(1:10,1:10) names(xy) <- c("x","y") z <- with(xy,2*x+y) dem <- data.frame(xy,z) xy2 <- data.frame(x=runif(8,1,10),y=runif(8,1,10)) z2 <- with(xy2,rnorm(8,2*x+y,sd=1)) ramm <- data.frame(xy2,z2) wireframe(z ~ x * y, data=dem, aspect = c(1, .5), scales = list(arrows = FALSE), panel.3d.wireframe = function(x, y, z,...) { panel.3dwire(x = x, y = y, z = z, ...) panel.3dscatter(x = x, y = y, z = z, data=ramm, ...) }) Making x, y, z in the panel.3dscatter call into ramm$x, ramm$y, ramm$z gives an error. -- View this message in context: http://www.nabble.com/add-points-to-wireframe-tf4522433.html#a12904664 Sent from the R help mailing list archive at Nabble.com.