0

When importing a .tif raster with terra::rast(), also a colormap is imported. Is there any way to force the function to not import the colormap, or to set it to NULL to use the default plot color palette?

You can see the color table with:

terra::coltab()

1 Answers1

2

Example data

library(terra)
r <- rast(ncols=3, nrows=2, vals=0:5)
coltb <- data.frame(t(col2rgb(rainbow(6, end=.9), alpha=TRUE)))
coltab(r) <- coltb

Normally, you should be able to do

coltab(r) <- NULL

But I see that the CRAN version has a bug (now solved in version 1.4-5). To work around it, you can do

coltab(r, 2) <- NULL
Robert Hijmans
  • 40,301
  • 4
  • 55
  • 63