Skip to contents

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.


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, ...)



an object used to select a method.


Parameters passed on to plot_rgl.fm_mesh_2d()


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


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


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()


# \donttest{
if (interactive() &&
    require("rgl", quietly = TRUE) &&
    require("sphereplot", quietly = TRUE) &&
    bru_safe_sp() &&
    require("sp")) {
  # Show the 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)
# }