Geom for RasterLayer objects
This function takes a RasterLayer object, converts it into a SpatialPixelsDataFrame and uses geom_tile to plot the data.
## S3 method for class 'RasterLayer' gg(data, mapping = aes_string(x = "x", y = "y", fill = "layer"), ...)
This function requires the raster
package.
An object returned by geom_tile
# 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) }
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.