>
> Date: Mon, 21 Nov 2011 12:08:35 +0100
> From: Boris Leroy <leroy.boris@gmail.com>
> To: r-sig-geo@r-project.org
> Subject: [R-sig-Geo] Issue with argument zlim() when plotting rasters
> Message-ID:
>        <CAFu_poHWUUkgbF2wbf8Xn2yhLWS+QBMtcyQHzbZ6uEV9ss7ShQ@mail.gmail.com
> >
> Content-Type: text/plain; charset=ISO-8859-1
>
> Hi all,
>
> I am trying to plot different rasters (same extent, different
> resolutions), with the same color scale.
>
> I have read the different threads aiming at specifying a single color
> scale for different rasters and the simplest one seem to specify
> zlim() when plotting.
> I tried with the example I found in the help page of plot {raster}.
>
> r <- raster(nrows=10, ncols=10)
> r <- setValues(r, 1:ncell(r))
> r[] <- runif(ncell(r))
> r2 <- r/2
> brks <- seq(0, 1, by=0.1)
> nb <- length(brks)-1
> par(mfrow=c(1,2))
> plot(r, breaks=brks, col=rev(terrain.colors(nb)), lab.breaks=brks,
> zlim=c(0,1))
> plot(r2, breaks=brks, col=rev(terrain.colors(nb)), lab.breaks=brks,
> zlim=c(0,1))
>
> It does not work as I expected: the scales are different between graphs.
> The first graph has a scale from 0 to 1, and the second one has a
> scale from 0 to 0.5. I expected to get a scale from 0 to 1 on both
> graphs.
> Is this a bug?  Or am I missing something?
>
> Many thanks,
>
> Boris
>
>
Hi Boris,

During my musings I found this :
http://stackoverflow.com/questions/4316692/how-can-i-create-raster-plots-with-the-same-colour-scale-in-r

This looks strangely similar to your problem...

I hope this helps.

Best,
Arthur



>
> --
> Boris Leroy,
> PhD Student,
> Equipe Biodiversit? et Gestion des Territoires,
> Service du Patrimoine Naturel, MNHN
> UMR 7204 CERSP, MNHN
> Universit? de Rennes 1
> Campus de Beaulieu, B?t. 25, 1er ?tage
> 35042 Rennes cedex
>
> +33 (0) 2 23 23 58 99
> +33 (0) 6 66 02 13 27

	[[alternative HTML version deleted]]

