[R-sig-Geo] spRbind for spplot

Paul Hiemstra p.hiemstra at geo.uu.nl
Tue Aug 17 20:21:43 CEST 2010


Dear Klaus,

You need to be more specific as to what you want exactly. From what I 
understand both your runoff and predictions are attributes that you want 
to use to fill the polygons. My first idea would be to make to plots 
next to each other, which is quite simple in spplot:

spplot(data, c("attribute1", "attribute2"))

If your attributes are not part of the same polygons set you can add one 
as a new attribute to the other:

plot_poly = rtopObj3$observations
plot_poly$predictions = rtopObj3$predictions$var1.pred
spplot(plot_poly, c("observations", "predictions"))

Is this satisfactory for you, and what do you mean by one map showing 
both? To show the results in one figure a scatterplot of observerd vs 
modeled is also a good idea.

regards,
Paul

On 08/17/2010 03:06 PM, Klaus Vormoor wrote:
> Dear all,
>
> I have an object (rtopObj3) including the SpatialPolygonDataFrames with
> runoff observations ($observations, "QNORM_12_4") for 100 gauged catchments
> and with predictions ($predictions, "var1.pred") for more than ungauged
> 2,000 catchments. So far, I only can plot either the observations or the
> predictions individually:
>
>    
>> spplot(rtopObj3$observations, "QNORM_12_4", col.regions = bpy.colors())
>> spplot(rtopObj3$predictions, "var1.pred", col.regions = bpy.colors())
>>      
> I want to create one map showing both. I tried the sp.layout argument
> without success. But since I also want to have both information combined for
> writing a shp-file, it may be more reasonable to use spRbind and do the plot
> later on. I unsuccessfully tried:
>
>    
>> observation = rtopObj3$observations
>> prediction = rtopObj3$predictions
>> rtopObj4<- spRbind(observation, prediction)
>>      
> Error in rbind(deparse.level, ...) :
>    numbers of columns of arguments do not match
>
> Does anyone know a way out?
> Thanks for every advice,
>
> Klaus
>    


-- 
Drs. Paul Hiemstra
Department of Physical Geography
Faculty of Geosciences
University of Utrecht
Heidelberglaan 2
P.O. Box 80.115
3508 TC Utrecht
Phone:  +3130 253 5773
http://intamap.geo.uu.nl/~paul
http://nl.linkedin.com/pub/paul-hiemstra/20/30b/770



More information about the R-sig-Geo mailing list