[R-sig-Geo] Terrain elevation plots with points shown --- spatstat.

Rolf Turner r.turner at auckland.ac.nz
Thu Apr 26 00:03:50 CEST 2018


On 25/04/18 19:45, Nicholas Bradley wrote (in a miss-titled post):

> Good morning
> 
> I hope you are well
> 
> I have a question regarding the persp and perspPoints functions
> 
> I have the x and y spatial coordinates and also the altitude of all
> these coordinates. However, despite consulting several manuals, I
> have as yet been unable to create a terrain elevation plot and also
> to plot the points.
> I have only managed to create a persp image showing density
> 
> I would therefore appreciate very much if anyone could be so kind as to help.

Your question is a bit vague and does not supply anything like a 
reproducible example, so it is hard to answer.

The cover of the book (Baddeley et al.) that Marcelino de la Cruz Rot 
has referred to, in the thread that you hijacked, displays a plot that 
might be something like what you want.  The code for producing this plot 
can be found in the online supplement to that book at:

     http://book.spatstat.org/chapter-code/chapter09.html

For your convenience here are the relevant lines of code:

     library(spatstat)
     fit     <- ppm(bei ~ polynom(grad, elev, 2), data=bei.extra)
     lamhat  <- predict(fit)
     col.lam <- topo.colors
     col.pts <- 1
     M       <- persp(bei.extra$elev, colin=lamhat,
                      colmap=col.lam, shade=0.4, theta=-55,
                      phi=25, expand=6, box=FALSE,
                      apron=TRUE,  visible=TRUE, main="")
                perspPoints(bei, Z=bei.extra$elev, M=M,
                            pch=".", col=col.pts, cex=1.25)

HTH

cheers,

Rolf Turner

-- 
Technical Editor ANZJS
Department of Statistics
University of Auckland
Phone: +64-9-373-7599 ext. 88276



More information about the R-sig-Geo mailing list