Matrix to nativeRaster

matrix_to_nr(mat, palette, dst = NULL)

Arguments

mat

integer matrix

palette

vector of colors. This palette must contain at least as many colors as the maximum integer value in mat.

dst

destination nativeRaster object. If NULL (the default) a new nativeRaster will be created If a nativeRaster is supplied here, it must have the exact dimensions to match the matrix

Value

nativeRaster

Examples

m <- matrix(1:12, 3, 4)
palette <- str_cols_to_packed_cols(rainbow(12))
nr <- matrix_to_nr(m, palette) 
plot(nr)