inverting color palete used in a plot in R base

gianmarco

TS Contributor
#1
Hello,

I am trying to invert the color palette used when plotting a RasterLayer.

See the attached example that can be reproduced with the code below:
C-like:
require(gdistance)
r <- raster(system.file("external/maungawhau.grd", package="gdistance"))
plot(r)
The output is an image representing the terrain elevation data for a volcanic cone near Auckland.
I would like to invert the color palette, so that areas at relative lower elevation will be given green, whereas high-elevation areas will tend toward white.

I cannot find a viable solution on my own.

Thanks
Gm
 

Attachments

gianmarco

TS Contributor
#3
Hello helicon,
thanks for the suggestion. Indeed, I overlooked that....thanks for bringing that to my attention.

Cheers
Gm