[R] erasing an area of a graph
tlumley at u.washington.edu
Thu Apr 8 22:51:37 CEST 2010
I don't think this is possible. With an opaque background you can get back the background color just by overwriting, but any additional painting can only increase the opacity so you can't get back to transparent.
On Thu, 8 Apr 2010, Terry Therneau wrote:
> 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
> R-help at r-project.org mailing list
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
Thomas Lumley Assoc. Professor, Biostatistics
tlumley at u.washington.edu University of Washington, Seattle
More information about the R-help