View source: R/im.plotRGB.auto.R
im.plotRGB.auto | R Documentation |
This function visualizes a multispectral raster image using the first three bands as an RGB composite. It applies a linear contrast stretch to enhance visualization.
im.plotRGB.auto(x, title = "Main")
x |
A 'SpatRaster' object representing the input multispectral image. |
title |
A character string specifying the plot title (default: "Main"). |
- The function assumes that the **first three bands** of the raster correspond to the Red, Green, and Blue channels. - It uses 'plotRGB()' with 'stretch="lin"' to enhance contrast. - The plot title is customizable via the 'title' parameter. - The axis and label colors are set to white for better contrast with dark backgrounds.
This function does not return an object. It directly generates a plot.
[im.import()], [im.ggplot()]
library(terra)
# Create a 3-band raster with random values
r <- rast(nrows = 10, ncols = 10, nlyrs = 3)
values(r) <- runif(ncell(r) * 3)
# Plot RGB composite
im.plotRGB.auto(r, title = "RGB Visualization")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.