View source: R/convert.globe.R
convertpoints | R Documentation |
Convert a matrix of spherical coordinates into a format that can be plotted using functions available in either the globe or sphereplot packages
convert.globe(X, inverse=FALSE, sp.dim=2) convert.sphereplot(X, inverse=FALSE, sp.dim=2)
X |
If |
inverse |
Logical. If TRUE, then conversion is to coordinates that can be used in spherstat. If FALSE, then converstion is to coordinates that can be used in globe ( |
sp.dim |
If |
If inverse=FALSE
, a 2 column matrix that can be plotted using functions in the package
globe (if convert.globe
used) or sphereplot (if
, convert.sphereplot
used). If inverse=TRUE
, a 2 column matrix of locations in spherical coordinates (if sp.dim=2
) or a 3 column matrix of locations in Cartesian coordinates (if sp.dim=3
).
convert.sphereplot
does not need the radius of the sphere; you
specify the radius when making calls to sphereplot functions suchh as rgl.sphgrid
and
rgl.sphpoints
that plot the data.
Also, if coordinates are converted using either function, and then converted back again with the same function, the doubly converted coordinates may differ from the orignal coordinates by a minute quantity (i.e.~in the vicinity of 10^-16).
Tom Lawrence <email:tjlawrence@bigpond.com>
convert2
, convert3
sphere <- sphwin(type="sphere") X <- rpoispp.sphwin(win=sphere, lambda=150) X.sphereplot <- convert.sphereplot(X) if(require(sphereplot)) { rgl.sphgrid(longtype="D") rgl.sphpoints(long=X.sphereplot, radius=1) Xback <- convert.sphereplot(X.sphereplot, inverse=TRUE, sp.dim=2) } if(require(globe)) { X <- rpoispp.sphwin(win=sphere, lambda=150, rad=1) X.globe <- convert.globe(X) globeearth(eye=place("northpole"), top=place("nedlands")) globepoints(loc=X.globe, eye=place("northpole"), top=place("nedlands")) Xback <- convert.globe(X.globe, inverse=TRUE, sp.dim=3) }
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.