[R] Creating 3D plot

Sarah Goslee sarah.goslee at gmail.com
Wed Nov 9 19:06:26 CET 2011


Hi,

On Wed, Nov 9, 2011 at 11:56 AM, Michal Zimmermann <zimmicz at gmail.com> wrote:
> Hi to all,
> i have a data set of international airports with latitude, longitude and
> altitude. I was thinking of creating a 3D plot out of them, but haven't
> succeeded yet.
> With
> plot3d(x=seq(min(traffic$lon),max(traffic$lon)),y=seq(min(traffic$lat),max(traffic$lat)),z=traffic$alt)
> all i get is http://imageshack.us/photo/my-images/225/70758244.png/. What i
> wanna get is a 3Dlike map of airports in the world. Am i using good
> function to achieve that? Why are the points "lined" up and don't copy
> their 2D shape (http://imageshack.us/photo/my-images/36/91660845.png/)?.

Your points are "lined up" because you're plotting
seq(min(traffic$lon),max(traffic$lon)) instead of your actual x
coordinates, and ditto for y.

I would think that you want
plot3d(x=traffic$lon, y=traffic$lat, z=traffic$alt)
but since you don't provide data (or even which package provided the
plot3d() function you're using, since there's more than one), it's
hard to say for certain.

Sarah

> Thanks for replies or hints, i'm new to R and as a geography student i'm
> especially interested in handling and visualizing geodata.
>
>



-- 
Sarah Goslee
http://www.functionaldiversity.org



More information about the R-help mailing list