3D Surface plot

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

3D Surface plot

Simon Delay-Fortier
Hi everyone,

I am a very new user of r (doing most of my previous stuff in vba). I am now mandated to draw a 3-d surface of a mine pit hole. I have all the location points (around 5000 points) of the pit in a CSV file under 3 column X, Y & Z. However, going from page to page on the web, I could not figure out how to code the figure. Something I noted is that most of the time X and Y  have to be in ascending order but the data I have are not (since they are finite points of the pit, if X gets  in ascending order, Y and Z are not). Also with the data, sometimes 2 rows fallowing each ohter have the same X and Y value with a different Z. That would be nice if things could be modeled with rgl function in order to have a rotating pit, but I would be glad to only have a 3d surface to start!

Hope you can help.
Sincerly,

Simon Delay-Fortier
______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

3D Surface Plot

Simon Delay-Fortier
Hi everyone,I am a very new user of r. I am now mandated to draw a 3-d surface (and possibly rotating) of a mine pit hole. I have all the location points (around 5000 points) of the pit in a CSV file under 3 column X, Y & Z. The fllowing gives a 3d scatter but i would like to have a surface.

attach(EASTPITCREST)
par(bg="grey6", col.lab="white", col.axis="white", col.main="white", col.sub="white")
scatterplot3d(X, Y, Z, color = "red", pch=19, main="Mine and Drilling Map")

I noted is that most of the time X and Y  have to be in ascending order but the data I have are not (since they are finite points of the pit, if X gets  in ascending order, Y and Z are not). Also with the data, sometimes 2 rows fallowing each ohter have the same X and Y value with a different Z.

Hope you can help.
Sincerly,

Simon Delay-Fortier
______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: 3D Surface plot

barry rowlingson
In reply to this post by Simon Delay-Fortier
On Wed, Dec 18, 2013 at 2:52 PM, Simon Delay-Fortier
<[hidden email]> wrote:
> Hi everyone,
>
> I am a very new user of r (doing most of my previous stuff in vba). I am now mandated to draw a 3-d surface of a mine pit hole. I have all the location points (around 5000 points) of the pit in a CSV file under 3 column X, Y & Z. However, going from page to page on the web, I could not figure out how to code the figure. Something I noted is that most of the time X and Y  have to be in ascending order but the data I have are not (since they are finite points of the pit, if X gets  in ascending order, Y and Z are not). Also with the data, sometimes 2 rows fallowing each ohter have the same X and Y value with a different Z. That would be nice if things could be modeled with rgl function in order to have a rotating pit, but I would be glad to only have a 3d surface to start!

 How "3d" is your surface here? Because there's "3d" and there's
what's known as "2.5d"

 A 3d surface could be something like the surface of a sphere, or a
cave, or an overhanging cliff, whereas a 2.5d surface is a
single-valued function of x and y.

 If you have a true 3d surface then that's beyond me and involves
working out surface normals and all sorts of other clever stuff which
I don't know about.

 If its really 2.5d then yes, you do need to compute the values of
your surface on a grid in order to display it using rgl's surface3d
function. You can do this with some 2d interpolation code, such as
kriging or inverse distance weighting, using assorted packages such as
automap (which makes it easy but beware) or gstat.

 Since this seems to be a real-world geography problem, you might haul
over to the r-sig-geo mailing list and as there where the spatial guys
hang out.

Barry

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: 3D Surface Plot

Adams, Jean
In reply to this post by Simon Delay-Fortier
Check out the wireframe() function in the R package lattice ...

library(lattice)
?wireframe

Jean


On Wed, Dec 18, 2013 at 9:30 AM, Simon Delay-Fortier <
[hidden email]> wrote:

> Hi everyone,I am a very new user of r. I am now mandated to draw a 3-d
> surface (and possibly rotating) of a mine pit hole. I have all the location
> points (around 5000 points) of the pit in a CSV file under 3 column X, Y &
> Z. The fllowing gives a 3d scatter but i would like to have a surface.
>
> attach(EASTPITCREST)
> par(bg="grey6", col.lab="white", col.axis="white", col.main="white",
> col.sub="white")
> scatterplot3d(X, Y, Z, color = "red", pch=19, main="Mine and Drilling Map")
>
> I noted is that most of the time X and Y  have to be in ascending order
> but the data I have are not (since they are finite points of the pit, if X
> gets  in ascending order, Y and Z are not). Also with the data, sometimes 2
> rows fallowing each ohter have the same X and Y value with a different Z.
>
> Hope you can help.
> Sincerly,
>
> Simon Delay-Fortier
> ______________________________________________
> [hidden email] 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.
>

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] 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.