plot_index: Visualize a Spectral Index with Thematic Color Palettes

View source: R/plotting.R

plot_indexR Documentation

Visualize a Spectral Index with Thematic Color Palettes

Description

Plots a single-layer or selected layer from a terra::SpatRaster index object using tailored color palettes designed for vegetation, water, soil, urban, and custom analysis.

Usage

plot_index(x, index = NULL, main = NULL, col = NULL, ...)

Arguments

x

A terra::SpatRaster object containing index values.

index

Optional character string specifying which layer to plot if x contains multiple layers.

main

Optional plot title. Defaults to the layer name.

col

Optional color palette. If NULL (default), an appropriate palette is automatically chosen based on the index category or a perceptual palette for custom indices.

...

Additional graphical arguments passed to terra::plot.

Value

Invisible terra::SpatRaster object that was plotted.

Examples

img <- get_example_data()
ndvi <- geo_index(img, "NDVI")
plot_index(ndvi)


GeoIndexR documentation built on Oct. 10, 2026, 5:08 p.m.