Create a ‘mask’ polygon | R Documentation |
Takes a polygon object and creates a new polygon whose outline is rectangular, but has a hole shaped like the input polygon cut into it. This is useful for plotting surfaces defined over a study area, but masking the values outside of the area. It is designed to work with pixel images, so that the mask covers up all parts of the image not in the input polygon.
poly.outer(exo.object,input.poly,extend=0)
exo.object |
The object extending beyond |
input.poly |
The polygon used to make the hole in the mask. |
extend |
A buffer used to extend the mask if it is required to be larger than |
A polygon object whose outline is rectangular, but having holes cut into it in the shape of input.poly
Chris Brunsdon, Binbin Lu
add.masking
, kde.points
.
# 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.