sl.plot.init | R Documentation |
Initialise a standard spheRlab plot. Returns a plot specifics list that needs to be provided to any spheRlab plotting functions called afterwards, ended by a call of sl.plot.end
.
sl.plot.init(projection = "lonlat", lonrange = c(-180,180), latrange = c(-89,89), lonlatrot = NULL, polar.latbound = 0, regpoly.N = 3, regpoly.lat0 = 60, regpoly.rotfrac = 0, col.background = NULL, precision = 1, main = "", xshift = 0, yshift = 0, device = "pdf", do.init = TRUE, file.name = NULL, width = 12, transform.function = NULL, mar = rep(0,4), lonlat.lonrange = c(-180,180), lonlat.latrange = c(-85,85), lonlat.lonlatrot = NULL, polar.lonlatrot = c(0,90,0), regpoly.lonlatrot = c(0,90,0))
projection |
a character specifing the plot projection type. Currently possible projections are |
lonrange |
a vector of length 2 specifying the plot longitude range in ascending order. Only used if |
latrange |
a vector of length 2 specifying the plot latitude range in ascending order. Absolute values above 89 degrees are forbidden. Only used if |
lonlatrot |
|
polar.latbound |
a scalar in the range [0,90) specifying the latitude (post-rotation) at which the plot shall be truncated. Default is |
regpoly.N |
an integer specifying the number of vertices of the regular polygon. |
regpoly.lat0 |
a scalar in the range (0,90) specifying the latitude (post-rotation) at which the vertices of the regular polygon shall be placed. Default is |
regpoly.rotfrac |
a scalar in the range [0,1) specifying at which longitude (post-rotation) the 'first' vertex of the regular polygon shall be placed. The argument is not the longitude itself, but the fraction by which the vertex shall be rotated from |
col.background |
a background colour. Default is |
precision |
a scalar specifying for projections with curved boundaries the precision (in degrees) at which the backgound polygon boundary is broken into straight line segments. Used only if |
main |
a character specifying the main plot title. |
xshift |
a scalar specifying how far the plot region shall be shifted in x-direction. Default is |
yshift |
a scalar specifying how far the plot region shall be shifted in y-direction. Default is |
device |
a character specifying which graphics device to use. Default is |
do.init |
a logical value indicating whether or not an initial call of |
file.name |
a character specifying the output file. Default is |
width |
a scalar giving the width of the resulting figure. The height will be derived according to the chosen projection and other relevant plotting parameters. Only used if |
transform.function |
a function that transforms longitudes and latitudes (as two input arguments 'lon' and 'lat') into 'transformed' longitudes and latitudes. Can be used for fancy adjustments, e.g., to zoom into a region. Default is |
mar |
a numerical vector of the form |
lonlat.lonrange |
deprecated, use |
lonlat.latrange |
deprecated, use |
lonlat.lonlatrot |
deprecated, use |
polar.lonlatrot |
deprecated, use |
regpoly.lonlatrot |
deprecated, use |
For a standard single-panel spheRlab plot, this function needs to be called explicitly to initialise the plot, and to generate a plot specifics list that needs to be provided to any spheRlab plotting functions called afterwards to transfer information of the projection, rotation, plot range, and so forth. For a multi-panel plot as generated by sl.plot.platon.init
or sl.plot.3D.init
, this function is called internally once for every panel.
A (single-panel) spheRlab plot specifics list.
Elements that are always returned are:
projection |
a character specifying the projection. |
lonlatrot |
see the corresponding argument. |
alpha |
a scalar specifying the alpha parameter derived from |
beta |
a scalar specifying the beta parameter derived from |
gamma |
a scalar specifying the gamma parameter derived from |
xlim |
a vector of length 2 specifying the projected x-range (used also as argument |
ylim |
a vector of length 2 specifying the projected y-range (used also as argument |
xshift |
see the corresponding argument. |
yshift |
see the corresponding argument. |
transform.function |
see the corresponding argument. |
Additional list elements depend on the projection.
For projection
one of "lonlat"
and "mollweide"
:
lonrange |
see the corresponding argument. |
latrange |
see the corresponding argument. |
For projection="polar"
:
polar.latbound |
see the corresponding argument. |
For projection="regpoly"
:
regpoly.N |
see the corresponding argument. |
regpoly.lat0 |
see the corresponding argument. |
regpoly.z0 |
a scalar specifying the z-coordinate (post-rotation) of the regular polygon vertices (on a unit sphere). |
regpoly.rotfrac |
see the corresponding argument. |
regpoly.cornerlons0 |
a vector of length |
regpoly.lat0i |
a scalar specifying the maximum latitude (post-rotation) of the regular polygon edges (located at the great-circle edge midpoints). |
regpoly.cornerlons |
a vector of length |
regpoly.cornerlats |
a vector of length |
Projections to be added include: "robinson"
and "mercator"
.
The projection "regpoly"
corresponds to a polar orthographic projection, truncated along a regular polygon, which allows composing the whole spherical surface with precisely connecting polygons, forming a platonian-type body (e.g. cube or icosahedron). sl.plot.platon.init
calls this function multiple times to plot onto platonian-type bodies.
Typical multi-panel plotting (beyond the rather special functions sl.plot.platon.init
or sl.plot.3D.init
) shall be implemented at some point, too, making use of this function in a similar way as sl.plot.platon.init
and sl.plot.3D.init
, but with explicit calls inbetween where the current panel to be plotted into will need to be specified.
Helge Goessling
sl.plot.end
, sl.plot.platon.init
, sl.plot.3D.init
pir = sl.plot.init(projection="mollweide",latrange=c(-89,89))
sl.plot.naturalearth(pir, resolution="coarse")
sl.plot.lonlatgrid(pir, col="grey", labels=TRUE, labels.cex=0.7, labels.col="orange")
sl.plot.end(pir)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.