[R-sig-Geo] Mask a map using statistical significance
Thiago V. dos Santos
thi_veloso at yahoo.com.br
Wed May 4 01:11:29 CEST 2016
Dear all,
In climate studies, it is a common practice to perform some statistical test between two fields (maps), and then plot the resulting map using a significance mask. This masking is usually done by adding some kind of pattern (shading, crosshatching etc) on top of the actual color palette.
Examples can be seen here in this image https://www3.epa.gov/climatechange/images/science/GlobalPrecipMap-large.png and in the left images of this panel:
http://www.nature.com/nclimate/journal/vaop/ncurrent/images_article/nclimate2996-f3.jpg
In my case, I ran a statistical test for detecting trend on a time-series raster and I now have one raster with the trend for rainfall (in degree C per year) and one with the p-values associated to the test.
My data looks roughly like this:
require(raster)
## scratch raster objects and fill them with some random values
r.trend <- raster(nrows=50, ncols=50, xmn=-58, xmx=-48, ymn=-33, ymx=-22)
r.trend[] <- round(runif(50 * 50, min=0, max=3), digits=2)
r.pvalue <- raster(nrows=50, ncols=50, xmn=-58, xmx=-48, ymn=-33, ymx=-22)
r.pvalue[] <- round(runif(50 * 50, min=0.0001, max=0.1), digits=5)
What I would like to do is to plot r.trend, and on top of it plot r.pvalue (as a pattern) where r.pvalues < 0.01 (corresponding to a significance level of 99%).
Has anyone here ever tried to do a similar plot and can point me to any direction?
I usually use rasterVis and ggplot2 to plot maps, but I would be open to try some other package and even other SIG software other than R.
Many thanks in advance, -- Thiago V. dos Santos
PhD student
Land and Atmospheric Science
University of Minnesota
More information about the R-sig-Geo
mailing list