Learn R Programming

terra (version 1.2-5)

RGB: Declare RGB channels

Description

Get or set the layers to be used as Red, Green and Blue when plotting a SpatRaster. Currently, the sole benefit of this is that plot will send the object to plotRGB

Usage

# S4 method for SpatRaster
RGB(x)

# S4 method for SpatRaster RGB(x)<-value

Arguments

x

SpatRaster

value

positive integers indicating the layers that are red, green and blue. Or NULL to remove the RGB settings

Examples

Run this code
# NOT RUN {
s <- rast(system.file("ex/logo.tif", package="terra"))   
RGB(s) <- c(1,2,3)
plot(s)
RGB(s) <- NULL
# }

Run the code above in your browser using DataLab