[R] Visualizing Points on a Sphere
Duncan Murdoch
murdoch.duncan at gmail.com
Fri Feb 25 15:03:40 CET 2011
On 25/02/2011 8:21 AM, Lorenzo Isella wrote:
> Dear All,
> I need to plot some points on the surface of a sphere, but I am not sure
> about how to proceed to achieve this in R (or if it is suitable for this
> at all).
> In any case, I am not looking for really fancy visualizations; for
> instance you can consider the images between formulae 5 and 6 at
>
> http://bit.ly/hOgK9h
>
> Any suggestion is appreciated.
Those plots show simple linear projections of the points, after culling
those that are on the far side of the sphere. That's very easy for the
points, slightly more work for the grid. I'm not aware of any package
that implements all of it, but you could do it yourself fairly easily.
If you want something more fancy you could use the rgl package for 3d
plots that you can rotate. You'll still have to draw the grid, and
you'll probably find it a little painful to implement the hidden surface
removal: rgl uses depth checking to remove things, and because of
rounding error it's not very good at drawing points and lines on
surfaces. (There are new options to control depth checking; see
"depth_mask" and "depth_test" in ?material3d. You can probably improve
the default behaviour using those).
Duncan Murdoch
More information about the R-help
mailing list