add.masking: Draw a mask around a Grid Based Image

Description Usage Arguments Details Value Author(s) See Also Examples

Description

Takes an ‘mask’ type polygon object - basically a rectangle with a polygon hole cut through it - and draws this over an image. This has the effect of only showing the image inside the hole. This is useful for plotting surfaces defined over a study area, but masking the values outside of the area.

Usage

1
add.masking(maskPoly,color)

Arguments

maskPoly

A masking polygon as described above.

color

Colour of the mask. Defaults to white, but for example, sea could be shown as blue.

Details

Returns no value, but draws a mask on the current graphics device as a side effect

Value

None

Author(s)

Chris Brunsdon

See Also

poly.outer, kde.points.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
# Data for New Haven to use in example
data(newhaven)
# Do the KDE
breach.dens = kde.points(breach,lims=tracts)
# Plot the result
level.plot(breach.dens)
# Block out the part outside the study area
masker = poly.outer(breach.dens,tracts,extend=100); add.masking(masker)
# Plot census tract boundaries
plot(tracts,add=TRUE)

Example output

Loading required package: maptools
Loading required package: sp
Checking rgeos availability: TRUE
Loading required package: RColorBrewer
Loading required package: MASS
Loading required package: rgeos
rgeos version: 0.3-23, (SVN revision 546)
 GEOS runtime version: 3.4.2-CAPI-1.8.2 r3921 
 Linking to sp version: 1.2-3 
 Polygon checking: TRUE 

NOTE: rgdal::checkCRSArgs: no proj_defs.dat in PROJ.4 shared files

GISTools documentation built on May 6, 2019, 1:09 a.m.