Skip to content
Prev 24363 / 29559 Next

Mask a map using statistical significance

Your example looks a bit rubbish because you have mostly isolated
pixels. Let's make an example with an area so we can see the shading.
[1] 0.00000000 0.01041667

now convert your raster to polygons at the threshold you are
interested in. Let's imagine the area less than 0.001 (the central
circle here):

p_poly = rasterToPolygons(r.pvalue<0.001, dissolve=TRUE)

and overlay hatched polygons:

plot(r.pvalue) # or whatever your underlying data is
plot(p_poly[p_poly$layer==1,],density=5,add=TRUE, border=NA)

see help(polygon) for parameters to control the shading angle and
density. The "border=NA" above hides the outline which looks like
those maps you linked to.

Barry



On Wed, May 4, 2016 at 12:11 AM, Thiago V. dos Santos via R-sig-Geo
<r-sig-geo at r-project.org> wrote: