[R-sig-Geo] spplot and labels

Patrick Giraudoux patrick.giraudoux at univ-fcomte.fr
Sat Jan 22 15:49:55 CET 2011


Le 22/01/2011 11:38, Patrick Giraudoux a écrit :
> Hi again,
>
> I am working with spplot and would like to draw labels on a number if 
> items. I supposed that one must use the layout arguments of spplot, 
> but I understand from the doc that  sp.text(loc, txt, ...) can be used 
> only for one location and not for a matrix of locations (as the 
> 'classical' text function does in the package base).
>
> Is there a way to pass a matrix of locations + labels to the layout 
> argument ?
>
> Thanks in advance,
>
> Patrick
>
>
>


Sorry to respond to myself, but I got the trick. Just use ltext. Eg

pv<-data.frame(coordinates(ZonesFrancis),pv)
SpPv<-list("ltext",pv[,1:2],labels=round(pv[,4],2))

then:

spplot(FCgrid.sp,z=2,col.regions=mypal,sp.layout=list(SpPv))



More information about the R-sig-Geo mailing list