Question

Title says it all, pretty much. So far as I can tell, trying to pass a simple color palette by using the col argument, e.g., rasterImage(mydata,xleft=1,ybottom=1,xright=2,ytop=2,col=grey(0:4095/4096)) fails. What's more confusing is that the default palette seems to depend on the class of mydata .

If I have a matrix, rasterImage(as.raster(mymatrix), {etc} plots in grayscale, while using a RasterLayer object, rasterImage(as.raster(myRaster),{etc} plots in a topo color set.

Any suggestions for alternative (fast) tools to plot large images gratefully accepted.

Was it helpful?

Solution

I think just using useRaster=TRUE inside the basic graphics:image function is fine.

This works, and very quickly (as opposed to not rasterizing a large matrix), with a matrix or a RasterLayer object:

image(mydata, useRaster=TRUE, col={whatever})

I should have tried that before going off into wrapper functions.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top