Plot.SpatRast: Visualise raster data and overlay sf polygons if desired.

View source: R/Plotting.R

Plot.SpatRastR Documentation

Visualise raster data and overlay sf polygons if desired.

Description

Use the ggplot2 plotting engine to easily create visualisations of raster data - like the ones obtained using CDownloadS(...) - and overlay sf polygon data if desired.

Usage

Plot.SpatRast(
  SpatRast,
  SF,
  Dates,
  Legend = "Air Temperature [K]",
  COL = viridis::inferno(100),
  Size = 1,
  Shape = 1
)

Arguments

SpatRast

SpatRast object to visualise.

SF

Optional. SF object which to overlay.

Dates

Optional. Character vector of labels to apply to each layer of the SpatRast. By default, the content of the terra::time() field of the supplied SpatRast object.

Legend

Colour label legend.

COL

Colour palette.

Size

Optional. Size of SF overlay.

Shape

Optional. Shape of SF overlay if points.

Value

A ggplot2 object visualising a raster.

See Also

CDownloadS.

Examples

SpatRast <- terra::rast(system.file("extdata", "CentralNorway.nc", package = "KrigR"))[[1:2]]
data("Jotunheimen_poly")
SF <- Jotunheimen_poly
Plot.SpatRast(SpatRast = SpatRast, SF = SF)


ErikKusch/KrigR documentation built on Feb. 17, 2025, 2:09 p.m.