[R-sig-Geo] spplot: getting proportional col.regions across different plots

Federico Calboli f.calboli at imperial.ac.uk
Fri Oct 31 13:01:02 CET 2014


I think I found an answer:

mycols = colorRampPalette(c("blue", "cyan", "yellow", "red"), bias=1)

spplot(res.bare$krige_output[,1], col.regions = mycols(100)[1:15], sp.layout = c('sp.points', R.bare2, col='black', pch=16))

or thereabouts — I have something to work with anyway.

BW

F


On 31 Oct 2014, at 11:50, Federico Calboli <f.calboli at imperial.ac.uk> wrote:

> Hi All,
> 
> I am doing some kriging (on the heat loss of a floor) and I am producing three plots.
> 
> This code
> 
> spplot(res.bare$krige_output[,1], col.regions = rev(heat.colors(100)), sp.layout = c('sp.points', R.bare2, col='black', pch=16))
> 
> works flawlessly.  The main problem I have is that
> 
> col.regions = rev(heat.colors(100))
> 
> gives me the exact color scale across the three plots, while my ranges are quite different:
> 
> plot 1 0.4318156 1.8557941
> plot 2 2.318537 4.237029
> plot 3 9.861249 12.438198
> 
> Overall my heat loss goes from 0.4318156 to 12.438198 across the three maps.  I would like to now change the col.regions = rev(heat.colors(100)) so that the colors reflect this fact: if we assume that 0.4318156 == white and 12.438198 == full red I want the colours in each map to take this into account.
> 
> I have tried to partition the heat.colors(100) output across the three maps thus:
> 
> col.regions = rev(heat.colors(100)[1:15])
> 
> but it does not work.  Any ideas on how to achieve what I am describing?  BTW I am happy to expand the palette (say from blue to red) if that makes it simpler.
> 
> BW
> 
> F
> 
> 



More information about the R-sig-Geo mailing list