This function takes a RasterLayer object, converts it into a
SpatialPixelsDataFrame
and uses geom_tile
to plot the data.
See also
Other geomes for Raster data:
gg()
Examples
if (FALSE) { # \dontrun{
# 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", envir = environment())
# Convert elevation covariate to RasterLayer
elev <- as(gorillas.extra$elevation, "RasterLayer")
# Plot the elevation
ggplot() +
gg(elev)
}
} # }