background colour when add=T
One possibility would be to define a spatial polygon that represents the entire plotting area, then use the gDifference function from the rgeos package to create a map that excludes the land areas (or whatever you don't want to cover) and add the resulting polygon(s).
On Thu, Sep 13, 2012 at 8:04 AM, Rob Robinson <rob.robinson at bto.org> wrote:
Dear All, I am trying to plot some abundance density maps for different species of birds which may be either marine or terrestrial. Having created the density kernel (using kde from package ks), I plot() a background map (actually a SpatialPolygonsDataFrame) and I can colour the land and sea differently using col= and bg= options respectively, I can then overlay my kernel using filled.contour. What I would now like to do is mask the inappropriate part of the map. For marine birds this is easy, simply replot the map using add=T and col= to 'blank' out the part of the kernel over land. I thought the same would be true for landbirds, simply use bg= to mask out the sea. Unfortunately when you have add=T plot (not unreasonably, I suppose) doesn't seem to honour the bg= argument, it just (I presume) sets it to 'transparent'. Does anyone know if there is a way to subvert this? A posting from a couple of years ago suggests probably not, but I wondered if anything had changed in the interim? many thanks in advance for any insights... cheers rob ************** Find out about Britain's birds - www.bto.org/birdfacts ************** Dr Rob Robinson, Principal Ecologist British Trust for Ornithology, The Nunnery, Thetford, Norfolk, IP24 2PU Ph: +44 (0)1842 750050 E: rob.robinson at bto.org Fx: +44 (0)1842 750030 W: www.bto.org/about-bto/our-staff/rob-robinson ====== "How can anyone be enlightened, when truth is so poorly lit" =======
_______________________________________________ R-sig-Geo mailing list R-sig-Geo at r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Gregory (Greg) L. Snow Ph.D. 538280 at gmail.com