spplot and labels

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

spplot and labels

Patrick Giraudoux
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

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Reply | Threaded
Open this post in threaded view
|

Re: spplot and labels

Patrick Giraudoux
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))

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo