[R] erasing an area of a graph

Terry Therneau therneau at mayo.edu
Thu Apr 8 20:51:19 CEST 2010

I have a case where the easiest way to draw a particular symbol would be
to draw something a little bigger, and then use polygon(... , col=0) to
erase the extra stuff.  Just how to do this best when par('bg') =
'transparent' is, however, eluding me.  I've looked through the archives
and the book R Graphics without quite seeing the light.
  Help or pointers to help would be welcome.

Terry T

Details (for the inquiring mind).  In drawing a pedigree  subjects are
depicted as cirle, square, diamond, or triangle (for gender= male,
female, unknown, terminated).  This can be subdivided into shaded
regions to show the value of various ancillary variables.  One ancillary
is easy - just fill with a color.  For two you fill the left and right
half separately, etc.  Two, three, four, ... variables become special
cases for each symbol.  An easy solution is to draw a larger circle with
the requisite number of shaded slices, then erase away what we don't

More information about the R-help mailing list