Hello list! I have a problem with the function 'persp'. I have a data set with the variables X -> The X coordenate of the insect Y -> The Y coordenate of the insect deep-> how deep the insect buried into the soil. I would like to have a plot with a surface simulating the way the insect buried. Is it possible? If I type persp(x,y,deep) R gives me this error message Error in persp.default(X, Y, deep) : increasing x and y values expected How do I overcome this? Thanks, Marcos -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Hello Marcos library (akima) includes a function interp() which will do what you want. rksh> > Hello list! > > I have a problem with the function 'persp'. I have a data set with the > variables > X -> The X coordenate of the insect > Y -> The Y coordenate of the insect > deep-> how deep the insect buried into the soil. > > I would like to have a plot with a surface simulating the way the insect > buried. Is it possible? If I type > > persp(x,y,deep) > > R gives me this error message > > Error in persp.default(X, Y, deep) : > increasing x and y values expected > > How do I overcome this? > > Thanks, > > Marcos >-- Robin Hankin, Lecturer, School of Geographical and Environmental Science Private Bag 92019 Auckland New Zealand r.hankin at auckland.ac.nz tel 0064-9-373-7599 x6820; FAX 0064-9-373-7042 as of: Fri May 3 09:26:01 NZST 2002 This (linux) system up continuously for: 246 days, 16 hours, 21 minutes -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
persp() takes a matrix and plots it as a surface. I'm not entirely sure of what you're saying, but if you just want to plot the points, you might consider using the scatterplot3d package on CRAN. If you want a surface, then you might want to smooth the points -- for instance, you could use sm.regression() from the sm package. -roger _______________________________ UCLA Department of Statistics rpeng at stat.ucla.edu http://www.stat.ucla.edu/~rpeng On Thu, 2 May 2002, Marcos Sanches wrote:> > Hello list! > > I have a problem with the function 'persp'. I have a data set with the > variables > X -> The X coordenate of the insect > Y -> The Y coordenate of the insect > deep-> how deep the insect buried into the soil. > > I would like to have a plot with a surface simulating the way the insect > buried. Is it possible? If I type > > persp(x,y,deep) > > R gives me this error message > > Error in persp.default(X, Y, deep) : > increasing x and y values expected > > How do I overcome this? > > Thanks, > > Marcos > > -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- > r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html > Send "info", "help", or "[un]subscribe" > (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch > _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._ >-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
What you need is Delanguay triangulation. Here is a demo: http://www.cs.cornell.edu/Info/People/chew/Delaunay.html You want to do a 3D plot of this, as shown here: http://www.colorado.edu/ITS/docs/scientific/idl/3D.html Not simple in R I don't think, though there apparently there is a package akima that allows you to do it. If you figure this out I would be very interested in seeing a simple working example. Bill -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._