[R-sig-Geo] plot raster: how to eliminate surrounding white space?

Agustin Lobo alobolistas at gmail.com
Tue Aug 27 15:15:17 CEST 2013


I have raster images with many more rows than columns, i.e
require(raster)
a <- raster(matrix(200,ncol=256,nrow=3171))
extent(a) <- c(0,256,0,3177)

and get too much blank space at plotting:

plot(a,axes=FALSE,legend=FALSE)

in particular if I want to display several bands in the same plot:
a <- stack(a,a*2,a/2,a*3)
plot(a,axes=FALSE,legend=FALSE)

Is there a way to optimize the plot so that rectangles are closer?

Thanks

Agus



More information about the R-sig-Geo mailing list