gg.SpatialPixels: Geom for SpatialPixels objects

View source: R/ggplot.R

gg.SpatialPixelsR Documentation

Geom for SpatialPixels objects

Description

Uses geom_point to plot the pixel centers. Requires the ggplot2 package.

Usage

## S3 method for class 'SpatialPixels'
gg(data, ...)

Arguments

data

A sp::SpatialPixels object.

...

Arguments passed on to geom_tile.

Value

A geom_tile return value.

See Also

Other geomes for spatial data: gg(), gg.SpatRaster(), gg.SpatialGridDataFrame(), gg.SpatialLines(), gg.SpatialPixelsDataFrame(), gg.SpatialPoints(), gg.SpatialPolygons(), gg.sf()

Examples

if (require("ggplot2", quietly = TRUE) &&
  bru_safe_sp()) {
  # Load Gorilla data

  data(gorillas, package = "inlabru")

  # Turn elevation covariate into SpatialPixels
  pxl <- sp::SpatialPixels(sp::SpatialPoints(gorillas$gcov$elevation))

  # Plot the pixel centers
  ggplot() +
    gg(pxl, size = 0.1)
}

inlabru-org/inlabru documentation built on Sept. 18, 2024, 1:53 a.m.