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

Dieter Vanderelst dieter_vanderelst at emailengine.org
Mon Jun 16 18:38:07 CEST 2008


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,

Regards,
Dieter



More information about the R-help mailing list