classRaster_as.raster: Export raster object to a colored representation.

as.rasterR Documentation

Export raster object to a colored representation.

Description

as.raster transforms object of class ursaRaster to the object of class raster (package grDevices)

Usage

## S3 method for class 'ursaRaster'
as.raster(x, ...)

Arguments

x

ursaRaster object

...

Set of arguments, which are recognized via their names (using regular expressions) and classes:

max

number giving the maximum of the color values range. Passed to function as.raster for S3 class 'array'. Default is 255.

Value

A raster object. It is a matrix. The values of matrix are colors.

Author(s)

Nikita Platonov platonov@sevin.ru

See Also

as.array

Examples

session_grid(NULL)
session_grid(regrid(mul=1/2))
a <- ursa_dummy(4,min=0,max=255)
a[a<70] <- NA
compose_open(layout=c(1,4),legend=NULL)
for (i in seq(4)) {
   panel_new()
   panel_plot(as.raster(a[seq(i)]),interpolate=FALSE)
   panel_annotation(paste("Number of channels:",i))
}
compose_close()

op <- par(mfrow=c(2,2),mar=rep(0.5,4))
plot(as.raster(a[1:1]),interpolate=FALSE)
plot(as.raster(a[1:2]),interpolate=FALSE)
plot(as.raster(a[1:3]),interpolate=FALSE)
plot(as.raster(a[1:4]),interpolate=FALSE)
par(op)

nplatonov/ursa documentation built on Feb. 2, 2024, 4:08 a.m.