[R-sig-Geo] can spplot add features ?

Paul Hiemstra p.hiemstra at geo.uu.nl
Tue Jul 7 12:54:57 CEST 2009


Or you can define a panel function yourself along these lines:

spplot(grid_object, "layer_to_plot",
    panel = function(...) {
        panel.gridplot(...) # Standard panel function for grids
        sp.polygons(polygon_object)	# Extra stuff on top
        sp.points(point_object)
    }

cheers,
Paul

Edzer Pebesma wrote:
> Patrick Giraudoux wrote:
>   
>> Edzer Pebesma a écrit :
>>     
>>> Patrick Giraudoux wrote:
>>>  
>>>       
>>>> Dear listers,
>>>>
>>>> I would like to add the border of  a country (SpatialPolygons object
>>>> called ChinaBorder) in a spplot built as following:
>>>>
>>>> mypal<-colorRampPalette(c("white", "cyan",
>>>> "blue","green","yellow","red"))
>>>> statSpat<-SpatialPointsDataFrame(chinagrid,data.frame(n=z))
>>>> gridded(statSpat)<-TRUE
>>>> spplot(statSpat,col.regions=mypal)
>>>>
>>>> I cannot managed to overlap ChinaBorder to statSpat with the 'panel'
>>>> argument of spplot.
>>>>
>>>> Any idea about how to proceed ?
>>>>     
>>>>         
>>> Patrick, you might want to try
>>>
>>> spplot(statSpat, col.regions = mypal, sp.layout = list("sp.polygons",
>>> ChinaBorder))
>>>  
>>>       
>>>> P
>>>>         
>> Exactly what I need (the way to state was unclear to me in the doc),
>> except the image is overlapping the border when I would like to get
>> the reverse (the contour over the image). Is there a way to make it ?
>>
>> Cheers,
>>
>> Patrick
>>
>>     
> Try
>
> spplot(statSpat, col.regions = mypal, sp.layout = list("sp.polygons",
> ChinaBorder, first = FALSE))
>
> or maybe TRUE.
> --
> Edzer
>
>   


-- 
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 274 3113 Mon-Tue
Phone:  +3130 253 5773 Wed-Fri
http://intamap.geo.uu.nl/~paul



More information about the R-sig-Geo mailing list