[R-sig-Geo] plotting raster* objects: controlling the display scale

Matthias Boer M.Boer at uws.edu.au
Thu Nov 10 08:12:29 CET 2011


Hi

I am plotting series of raster* objects with 'plot'. The raster* objects are change maps with variable scales. 
I want to plot them all with the same scale centred on zero such that it's easy to see where there is a positive or negative response. 
I am using zlim=c(display_min,display_max) to set the display scale but 'plot' seem to ignore these zlim settings when e.g. display_min is smaller than the minimum value in the raster* object, or display_max is larger than the maximum value in the raster. 'Image' does keep the specified zlim values.

# For example:
> fqr050pet110.dif
class       : RasterLayer 
dimensions  : 674, 818, 551332  (nrow, ncol, ncell)
resolution  : 0.05, 0.05  (x, y)
extent      : 112.825, 153.725, -43.725, -10.025  (xmin, xmax, ymin, ymax)
coord. ref. : NA 
values      : in memory
min value   : -0.02103391 
max value   : 0.03608033

# If I then use 'plot' with display interval from -0.1 to +0.1
plot(fqr050pet110.dif,col = rev(terrain.colors(100)),zlim=c(-0.1,0.1)) 

# the raster is plotted with the actual raster min and max value as the display interval.
# The same settings with 'image' does use the specified zlim. 

Is it possible to force 'plot' to scale the display according to the specified zlim?

Thanks for your time.

Matthias

----------------------------------------


Dr Matthias M Boer
Hawkesbury Institute for the Environment
University of Western Sydney

P: +61-(0)2-4570-1373 (direct)
P: +61-(0)2-4570-1941 (admin)
E: m.boer at uws.edu.au

Postal address: 
Locked Bag 1797, Penrith South DC 
NSW 1797 AUSTRALIA



More information about the R-sig-Geo mailing list