rspatial / terra

R package for spatial data handling https://rspatial.github.io/terra/reference/terra-package.html
GNU General Public License v3.0
543 stars 90 forks source link

map.pal("random") does not exist #1631

Closed aloboa closed 5 days ago

aloboa commented 3 weeks ago

The man page ?man.pal lists "random" as an optional color table, but

> map.pal("elevation",10)
 [1] "#00BFBF" "#00E254" "#1CFF00" "#A9FF00" "#FFE200" "#FF9B00" "#E97F14" "#C67F37" "#C39F7B" "#C8C8C8"
> map.pal("random",10)
Error: [map.pal] random is not a known palette

It's not a big deal, as the palette can be created beforehand, but it would be nicer if it were fixed.

kadyb commented 3 weeks ago

It seems that “grey.eq” and “grey.log” are also missing (they are listed in the table).

rhijmans commented 4 days ago

Thanks. I have added "random" and removed “grey.eq” and “grey.log” from the docs.

aloboa commented 1 day ago

Thanks. Very useful for classifications, eg

s <- rast(system.file("ex/logo.tif", package="terra"))  
plot(k_means(s, 4), col=map.pal("random",4))