Analysing spatial point patterns in R - CSIRO
Analysing spatial point patterns in R - CSIRO
Analysing spatial point patterns in R - CSIRO
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
8.1 Mak<strong>in</strong>g w<strong>in</strong>dows by hand 47<br />
8.1.3 Polygonal w<strong>in</strong>dow<br />
Spatstat supports polygonal w<strong>in</strong>dows of arbitrary shape and topology. That is, the boundary<br />
of the w<strong>in</strong>dow may consist of one or more closed polygonal curves, which do not <strong>in</strong>tersect<br />
themselves or each other. The w<strong>in</strong>dow may have ‘holes’. Type<br />
> ow<strong>in</strong>(poly = p)<br />
or<br />
> ow<strong>in</strong>(poly = p, xrange, yrange)<br />
to create a polygonal w<strong>in</strong>dow. The argument poly=p <strong>in</strong>dicates that the w<strong>in</strong>dow is polygonal<br />
and its boundary is given by the dataset p. Note we must use the “name=value” syntax to give<br />
the argument poly. The arguments xrange and yrange are optional here; if they are absent,<br />
the x and y dimensions of the bound<strong>in</strong>g rectangle will be computed from the polygon.<br />
If the w<strong>in</strong>dow boundary is a s<strong>in</strong>gle polygon, then p should be a matrix or data frame with<br />
two columns, or a list with components x and y, giv<strong>in</strong>g the coord<strong>in</strong>ates of the vertices of the<br />
w<strong>in</strong>dow boundary, traversed anticlockwise. For example, the triangle with corners (0,0),<br />
(1,0) and (0,1) is created by<br />
> Z plot(Z)<br />
Z<br />
Note that polygons should not be closed, i.e. the last vertex should not equal the first<br />
vertex. The same convention is used <strong>in</strong> the standard plott<strong>in</strong>g function polygon().<br />
If the w<strong>in</strong>dow boundary consists of several separate polygons, then p should be a list, each<br />
of whose components p[[i]] is a matrix or data frame or a list with components x and y<br />
describ<strong>in</strong>g one of the polygons. The vertices of each polygon should be traversed anticlockwise<br />
for external boundaries and clockwise for <strong>in</strong>ternal boundaries (holes). For example,<br />
the follow<strong>in</strong>g creates a triangle with a square hole.<br />
> Z plot(Z)<br />
Copyright<strong>CSIRO</strong> 2010