Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

gg.RasterLayer

Geom for RasterLayer objects


Description

This function takes a RasterLayer object, converts it into a SpatialPixelsDataFrame and uses geom_tile to plot the data.

Usage

## S3 method for class 'RasterLayer'
gg(data, mapping = aes_string(x = "x", y = "y", fill = "layer"), ...)

Arguments

data

A RasterLayer object.

mapping

aesthetic mappings created by aes or aes_. These are passed on to geom_tile.

...

Arguments passed on to geom_tile.

Details

This function requires the raster package.

Value

An object returned by geom_tile

See Also

Other geomes for Raster data: gg(), gm()

Examples

# Some features require the raster and spatstat.data packages.
if (require("spatstat.data", quietly = TRUE) &&
  require("raster", quietly = TRUE)) {

  # Load Gorilla data
  data("gorillas", package = "spatstat.data")

  # Convert elevation covariate to RasterLayer

  elev <- as(gorillas.extra$elevation, "RasterLayer")

  # Plot the elevation

  ggplot() +
    gg(elev)
}

inlabru

Bayesian Latent Gaussian Modelling using INLA and Extensions

v2.3.1
GPL (>= 2)
Authors
Finn Lindgren [aut, cre, cph] (<https://orcid.org/0000-0002-5833-2011>, Finn Lindgren continued development of the main code), Fabian E. Bachl [aut, cph] (Fabian Bachl wrote the main code), David L. Borchers [ctb, dtc, cph] (David Borchers wrote code for Gorilla data import and sampling, multiplot tool), Daniel Simpson [ctb, cph] (Daniel Simpson wrote the basic LGCP sampling method), Lindesay Scott-Howard [ctb, dtc, cph] (Lindesay Scott-Howard provided MRSea data import code), Seaton Andy [ctb] (Andy Seaton provided testing and bugfixes)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.