[R] re-arranging unsorted data for surface/contour plot

From: Dieter Vanderelst <dieter_vanderelst_at_emailengine.org>
Date: Mon, 16 Jun 2008 18:38:07 +0200

Hi list,

I'm struggling with plotting a 3d data set.

I have a data frame with x,y and z values. They occur in no particular order (ie x and y are not ordered).

However, I want to visualize the data using a contour plot.

Now, the x,y and z data going into contour() are supposed to be ordered.

My question is: Is their a quick way to re-arrange my data such that it can be fed to contour()?

I know about interp(). However, using this, I found some strange quirks in the interpolation that I would rather not see (both linair and non linear interpolation).

I have plotted my data with plot3d() in the RGL package. This works fine. But I need a 2d plot (x~y projection). Maybe I can color the plot3d() plot and use a projected version?

Any ideas are welcome,


R-help_at_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. Received on Mon 16 Jun 2008 - 17:10:36 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 16 Jun 2008 - 17:30:43 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive