Skip to content
Prev 7520 / 29559 Next

plot polygons - transparent holes/island

On Sat, 30 Jan 2010, Paulo Eduardo Cardoso wrote:

            
Polygons objects are plotted largest to smallest, as are Polygon objects 
in each Polygons object. Each Polygons object and all its constituent 
Polygon objects are painted the colour chosen for that Polygons object.

If you want the holes Polygon objects to overpaint their containing 
Polygon objects, in the base graphics plot() method, you set the pbg= 
argument to the background colour (not "transparent", this will let you 
see the painted Polygon below). In the spplot method, this is handled 
internally by reading the trellis.par.get()$background value, and using it 
if not "transparent", or "white" if it is "transparent".

Both approaches depend on the hole slot of the Polygon object being 
correctly set.

R graphics do not analyse objects leaving out say holes, they overpaint. 
This is because the holes are not "known" in advance by the functions 
being executed.

Hope this helps,

Roger