gg.RasterLayer {inlabru} | R Documentation |
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 = ggplot2::aes(x = .data[["x"]], y = .data[["y"]], fill = .data[["layer"]]),
...
)
Arguments
data |
A RasterLayer object. |
mapping |
aesthetic mappings created by |
... |
Arguments passed on to |
Details
This function requires the raster
and ggplot2
packages.
Value
An object returned by geom_tile
See Also
Other geomes for Raster data:
gg()
,
gm()
Examples
## Not run:
# Some features require the raster and spatstat.data packages.
if (require("spatstat.data", quietly = TRUE) &&
require("raster", quietly = TRUE) &&
require("ggplot2", 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)
}
## End(Not run)
[Package inlabru version 2.11.1 Index]