Dear All,

I know how to fill a polygon, using a basic R graphics device:

par(mai=c(0, 0, 0, 0))
plot(1:100, type="n")
polygon(c(20, 80, 80, 20), c(20, 20, 80, 80), col="lightblue")


But let's say I have an outer polygon like this:
polygon(c(0,100,100,0), c(0,0,100,100))

Is it possible to fill the area between the two polygons?

I realise there is a quick and dirty solution to fill the outer polygon,
then draw the inner polygon colored with white, but I would like to
actually "clip" the outer polygon to the boundaries of the inner one.

Of course, there are various packages which draw maps (i.e. maptools), but
I need this in base R graphics. In other words, is it possible to define a
polygon with a hole inside, in base R?

Thank you,
Adrian

-- 
Adrian Dusa
University of Bucharest
Romanian Social Data Archive
Soseaua Panduri nr.90
050663 Bucharest sector 5
Romania

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to