29.01.2015 Views

Analysing spatial point patterns in R - CSIRO

Analysing spatial point patterns in R - CSIRO

Analysing spatial point patterns in R - CSIRO

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

D<br />

y<br />

66 Pixel images <strong>in</strong> spatstat<br />

Z<br />

pr<strong>in</strong>t basic <strong>in</strong>formation<br />

pr<strong>in</strong>t(Z) pr<strong>in</strong>t basic <strong>in</strong>formation<br />

summary(Z) pr<strong>in</strong>t detailed <strong>in</strong>formation<br />

dim(Z) pixel raster dimensions (y,x)<br />

nrow(Z) number of rows (y coord<strong>in</strong>ate)<br />

ncol(Z) number of columns (x coord<strong>in</strong>ate)<br />

range(Z) range of pixel values<br />

max(Z) maximum of pixel values<br />

m<strong>in</strong>(Z) m<strong>in</strong>imum of pixel values<br />

mean(Z) mean of pixel values<br />

median(Z) median of pixel values<br />

quantile(Z, ...) quantiles of pixel values<br />

sum(Z) sum of pixel values<br />

<strong>in</strong>tegral.im(Z) sum of pixel values times pixel area<br />

To compute other numerical summaries of pixel values that are not on this list, you can<br />

extract the pixel values us<strong>in</strong>g as.matrix(Z) then apply the desired operation.<br />

10.2.2 Plott<strong>in</strong>g an image<br />

Methods for plott<strong>in</strong>g an image object <strong>in</strong>clude:<br />

plot.im display as colour image<br />

contour.im contour plot<br />

persp.im perspective plot of surface<br />

These are methods for generic functions, so you would typeplot(Z),contour(Z) orpersp(Z)<br />

to display a pixel image Z.<br />

> opa data(redwood)<br />

> D plot(D)<br />

> persp(D)<br />

> contour(D)<br />

> par(opa)<br />

D<br />

D<br />

D<br />

0 20 40 60 80 100 120<br />

x<br />

−1.0 −0.8 −0.6 −0.4 −0.2 0.0<br />

50<br />

30<br />

10<br />

20<br />

60<br />

40<br />

20<br />

40<br />

60<br />

90<br />

110<br />

120<br />

100<br />

30<br />

70<br />

80<br />

110<br />

100<br />

50<br />

70<br />

70<br />

60<br />

70<br />

100<br />

80<br />

110<br />

120<br />

30<br />

40<br />

90<br />

50<br />

60<br />

70<br />

50<br />

40<br />

80<br />

0.0 0.2 0.4 0.6 0.8 1.0<br />

For plot.im, note that the default colour map for image plots <strong>in</strong> R has only 12 colours<br />

and can convey a mislead<strong>in</strong>g impression of the gradation of pixel values <strong>in</strong> the image. Use the<br />

argument col to control the colour map.<br />

> opa plot(D)<br />

Copyright<strong>CSIRO</strong> 2010

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!