[R] fill the area outside a polygon

Greg Snow 538280 at gmail.com
Wed Dec 2 21:28:38 CET 2015


Adrian,

Draw the polygon once without the border and the whole in it, then go
back and draw the border around the outer polygon without any fill.

On Wed, Dec 2, 2015 at 9:31 AM, Adrian Dușa <dusa.adrian at unibuc.ro> wrote:
> On Wed, Dec 2, 2015 at 5:19 PM, David L Carlson <dcarlson at tamu.edu> wrote:
>>
>> Using only base graphics, one solution would be to embed the inner
> polygon in the outer one and turn off the border:
>>
>> par(mai=c(0, 0, 0, 0))
>> plot(1:100, type="n")
>> polygon(c(0, 100, 100, 0, 0, 20, 80, 80, 20, 20, 0),
>>      c(0, 0, 100, 100, 0, 20, 20, 80, 80, 20, 0), col="lightblue",
> border=NA)
>
>
> I see what you did, interesting.
> I do need the border though, although if this is the only solution, perhaps
> I could live without it.
>
> It's working on a Windows machine (which I presume you are using), but
> under MacOS I only get  the entire big polygon filled, including the hole
> in the middle.
>
> Thanks,
> 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 at 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.



-- 
Gregory (Greg) L. Snow Ph.D.
538280 at gmail.com



More information about the R-help mailing list