[R-sig-Geo] [R] How to label a polygon window (spatstat package)

Mohammad Tanvir Ahamed mashranga at yahoo.com
Sun Feb 11 03:44:05 CET 2018


Thanks. It works as expected . 
:)

Regards.............
Tanvir Ahamed 
 Stockholm, Sweden     |  mashranga at yahoo.com 






On Saturday, February 10, 2018, 2:44:05 PM GMT+1, Marcelino de la Cruz Rot <marcelino.delacruz at urjc.es> wrote: 





Maybe you meant something like this:


# example of several polygons (in a list)
x <- runif(20)
y <- runif(20)

polygons<- list()
for (i in 1:20) polygons[[i]]<- disc(radius=0.05, centre=c(x[i], y[i]))
plot(owin())
lapply(polygons, plot, add=T)

# label each polygon
labs<-letters
for (i in 1: length(polygons)) {xy<-centroid.owin(polygons[[i]]); 
text(xy$x,xy$y, labs[i])}



Cheers,

Marcelino



El 10/02/2018 a las 6:43, Mohammad Tanvir Ahamed via R-sig-Geo escribió:
> Thanks.
> when there is multiple polygon , it a problem .
> looking for something more .
>
> Regards.............
> Tanvir Ahamed
> Stockholm, Sweden     |  mashranga at yahoo.com
>
>
>
>
>
>
> On Saturday, February 10, 2018, 6:35:59 AM GMT+1, Michael Sumner <mdsumner at gmail.com> wrote:
>
>
>
>
>
> Try
>
> text(0.5, 0.5, label = "?text")
>
> On Sat, 10 Feb 2018, 16:22 Mohammad Tanvir Ahamed via R-help, <r-help at r-project.org> wrote:
>> Hi,
>> I want to label a polygon (circle or polygon) inside.
>> As for example code
>>
>> library(spatstat)
>> x <- runif(20)
>> y <- runif(20)
>> X <- ppp(x, y, window=disc(0.7))
>> plot(X)
>>
>> Now I want to label that circle inside . Can some one please help me ?
>> Thanks.
>>
>> Regards.............
>> Tanvir Ahamed
>> Stockholm, Sweden     |  mashranga at yahoo.com
>>
>> ______________________________________________
>> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.

>>
>

-- 
Marcelino de la Cruz Rot
Depto. de Biología y Geología
Física y Química Inorgánica
Universidad Rey Juan Carlos
Móstoles España

_______________________________________________
R-sig-Geo mailing list
R-sig-Geo at r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-geo



More information about the R-sig-Geo mailing list