[R-sig-Geo] spplot question

Paul Hiemstra p.hiemstra at geo.uu.nl
Sat Sep 12 09:14:33 CEST 2009


Roger Bivand schreef:
> On Fri, 11 Sep 2009, Eric Morway wrote:
>
>>
>> Edzer,
>>
>> I apologize for the confusion.  Is there an option in spplot that 
>> fills in blank/white cells (I'm assuming they are blank because they 
>> have a value less than the minimum cut) with the minimum color on the 
>> legend bar (in this case green)?  About a quarter of the way in from 
>> the left edge of the image you'll notice a "hole" in the plot due to 
>> these cells having values less than 10.  I would like to fill these 
>> cells in without altering the legend, if possible.
>
> No, please see the help page for levelplot() in lattice, the at= 
> argument is describes as follows:
>
>       at: numeric vector giving breakpoints along the range of 'z'.
>           Contours (if any) will be drawn at these heights, and the
>           regions in between would be colored using 'col.regions'.  In
>           the latter case, values outside the range of 'at' will not be
>           drawn at all.  This serves as a way to limit the range of the
>           data shown, similar to what a 'zlim' argument might have been
>           used for.  However, this also means that when supplying 'at'
>           explicitly, one has to be careful to include values outside
>           the range of 'z' to ensure that all the data are shown.
>
> So you'll need to adjust your at= to accommodate all of the data.
Something along the lines of:

at[1] = min(dataset)
at[length(at)] = max(dataset)

cheers,
Paul
>
> Roger
>
>
>>
>> Thanks, Eric
>>
>> Edzer Pebesma wrote:
>>> Eric, I've been reading your email over and over, but cannot understand
>>> what you want. I also could not find a question, despite your subject.
>>> -- 
>>> Edzer
>>>
>>> Eric Morway wrote:
>>>
>>>> Hello,
>>>>
>>>> I've been working on an image created with spplot and with help have
>>>> gotten it very close to the final product.  One final modification I
>>>> would like to make involves filling in grid cells with values less
>>>> than the minimum value on the legend with the color corresponding to
>>>> the bottom of the legend.  In the attached figure, the minimum legend
>>>> value is 10, but there a few spots with values as low as 0.01. These
>>>> cells are currently blank/white.  I would like to avoid including this
>>>> value on my legend due to the color spread on the plot becoming
>>>> homologous, that is, I would like the color spread to be maximized
>>>> between 10-1000.  Were I to go from 0.01-1000, the range I'm most
>>>> interested in (10-1000) would be confined to a more narrow range of
>>>> the legend.  I have played around with trying to specify a different
>>>> number of cuts for the legend vs plot area, but this causes a
>>>> disconnect between the legend and the colors displayed for the
>>>> different grid cells.  The spplot line looks like this (image 
>>>> attached):
>>>>
>>>> pts<-list("sp.points",K.dat,pch=3,col="black",labels=as.character(K.dat$Kh)) 
>>>>
>>>>
>>>> cuts<-c(10,20,30,40,50,60,70,80,90,100,200,300,400,500,600,700,800,900,1000) 
>>>>
>>>>
>>>> spplot(lzm.krige.dir["var1.pred"],at=cuts,colorkey=list(at=log10(cuts),labels=as.character(cuts)),scales=list(draw=TRUE), 
>>>>
>>>>  xlab="Easting",ylab="Northing",key.space="right",cex=1.1,col.regions=terrain.colors(22),main="Hydraulic 
>>>>
>>>> Conductivity of Layer 2",sp.layout=list(pts))
>>>>
>>>> Respectfully,
>>>> Eric Morway
>>>>
>>>> ------------------------------------------------------------------------ 
>>>>
>>>>
>>>> ------------------------------------------------------------------------ 
>>>>
>>>>
>>>> _______________________________________________
>>>> R-sig-Geo mailing list
>>>> R-sig-Geo at stat.math.ethz.ch
>>>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>>>>
>>>
>>>
>>
>> _______________________________________________
>> R-sig-Geo mailing list
>> R-sig-Geo at stat.math.ethz.ch
>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>>
>



More information about the R-sig-Geo mailing list