Вопрос:

How to plot Ripley’s L using Lest() function from spatstat

r spatstat

18 просмотра

1 ответ

1 Репутация автора

I have a csv file with number of points. The data is included longitude, latitude and date. I classified my data based on the season (spring, summer, autumn and winter). I need to calculate the Ripley’s L for each season. I used Lest() from package spatstat in R. I could plot Ripley’s L using this function. But the range of x axis (distance) for each plot (season) is different. How can I make all four plots (seasons) in the same range (distance)?

sa  <- readOGR(".", "boundary")  # Don't add the .shp extension

W   <- as(sa, "owin")

Summer.ppp <- as(Sum_UTM, "ppp")

Autumn.ppp <- as(Autumn_UTM, "ppp")

Winter.ppp <- as(Winter_UTM, "ppp")

Spring.ppp <- as(Spring_UTM, "ppp")


Summer <- Lest(Summer.ppp, correction="Ripley")
plot(Summer , xlab="distance (m)", ylab="K(d)", cex.lab= 2, cex.axis=2)
plot(Summer, . -r ~ r, ylab=expression(hat("L")), xlab="distance (m)",cex.lab= 2, cex.axis=2)


Autumn <- Lest(Autumn.ppp, correction="Ripley")
plot(Autumn, xlab="distance (m)", ylab="K(d)", cex.lab= 2, cex.axis=2)
plot(Autumn, . -r ~ r, ylab=expression(hat("L")), xlab="distance (m)",cex.lab= 2, cex.axis=2)

Winter <- Lest(Winter.ppp, correction="Ripley")
plot(Winter, xlab="distance (m)", ylab="K(d)", cex.lab= 2, cex.axis=2)
plot(Winter, . -r ~ r, ylab=expression(hat("L")), xlab="distance (m)",cex.lab= 2, cex.axis=2)

Spring <- Lest(Spring.ppp, correction="Ripley")
plot(Spring , xlab="distance (m)", ylab="K(d)", cex.lab= 2, cex.axis=2)
plot(Spring, . -r ~ r, ylab=expression(hat("L")), xlab="distance (m)",cex.lab= 2, cex.axis=2)
Автор: Holly Источник Размещён: 12.06.2019 06:13

Ответы (1)


0 плюса

2179 Репутация автора

You write that you have latitude and longitude, but at the same time your datasets are named something with "UTM", which would indicate that you have planar x,y coordinates. Which is it? In spatstat you can only work with planar coordinates. You don't declare which packages you are using. The as function above to convert to ppp is probably from maptools? In that case I think the window of the ppp is just set to the bounding box of the coordinates. You have an object called W which you would probably want to use as the window of the ppp. You can do something like:

Window(Spring.ppp) <- W

As mentioned in the comments you can simply specify xlim = c(lower,upper) in the call to plot, where lower and upper are the numeric values of the limits you want on the x axis.

Автор: Ege Rubak Размещён: 12.06.2019 08:36
Вопросы из категории :
32x32