Skip to contents

[Deprecated] in favour of fmesher::fm_pixels()

Generate SpatialPixels covering an inla.mesh.

Usage

pixels(mesh, nx = 150, ny = 150, mask = TRUE)

Arguments

mesh

An inla.mesh object

nx

Number of pixels in x direction

ny

Number of pixels in y direction

mask

If logical and TRUE, remove pixels that are outside the mesh. If mask is a Spatial object, only return pixels covered by this object.

Value

SpatialPixelsDataFrame covering the mesh

See also

Author

Fabian E. Bachl bachlfab@gmail.com

Examples

# \donttest{
if (require(ggplot2, quietly = TRUE)) {
  data("mrsea", package = "inlabru")
  pxl <- fm_pixels(
    mrsea$mesh,
    dims = c(50, 50),
    mask = mrsea$boundary,
    format = "sp",
    minimal = TRUE
  )
  ggplot() +
    gg(pxl, fill = "blue", alpha = 0.75) +
    gg(mrsea$mesh)

  pxl <- fm_pixels(
    mrsea$mesh,
    dims = c(50, 50),
    mask = mrsea$boundary,
    format = "sf",
    minimal = TRUE
  )
  ggplot() +
    gg(pxl, geom = "tile", fill = "blue", alpha = 0.75) +
    gg(mrsea$mesh)
}

# }