Learn R Programming

inlabru (version 2.11.1)

glplot: Render objects using RGL

Description

glplot() is a generic function for renders various kinds of spatial objects, i.e. Spatial* data and fm_mesh_2d objects. The function invokes particular methods which depend on the class of the first argument.

Usage

glplot(object, ...)

# S3 method for SpatialPoints glplot(object, add = TRUE, color = "red", ...)

# S3 method for SpatialLines glplot(object, add = TRUE, ...)

# S3 method for fm_mesh_2d glplot(object, add = TRUE, col = NULL, ...)

# S3 method for inla.mesh glplot(object, add = TRUE, col = NULL, ...)

Arguments

object

an object used to select a method.

...

Parameters passed on to plot_rgl.fm_mesh_2d()

add

If TRUE, add the points to an existing plot. If FALSE, create new plot.

color

vector of R color characters. See material3d() for details.

col

Color specification. A single named color, a vector of scalar values, or a matrix of RGB values.

Methods (by class)

  • glplot(SpatialPoints): This function will calculate the cartesian coordinates of the points provided and use points3d() in order to render them.

  • glplot(SpatialLines): This function will calculate a cartesian representation of the lines provided and use lines3d() in order to render them.

  • glplot(fm_mesh_2d): This function transforms the mesh to 3D cartesian coordinates and uses inla.plot.mesh() with rgl=TRUE to plot the result.

See Also

Other inlabru RGL tools: globe()

Other inlabru RGL tools: globe()

Other inlabru RGL tools: globe()

Other inlabru RGL tools: globe()

Examples

Run this code
# \donttest{
if (interactive() &&
    require("rgl", quietly = TRUE) &&
    require("sphereplot", quietly = TRUE) &&
    bru_safe_sp() &&
    require("sp")) {
  # Show the globe
  globe()

  # Load pantropoical dolphin data
  data("mexdolphin", package = "inlabru")

  # Add mesh, ship transects and dolphin sightings stored
  # as inla.mesh, SpatialLines and SpatialPoints objects, respectively

  glplot(mexdolphin$mesh, alpha = 0.2)
  glplot(mexdolphin$samplers, lwd = 5)
  glplot(mexdolphin$points, size = 10)
}
# }

Run the code above in your browser using DataLab