[R] fill the area outside a polygon

Adrian Dușa dusa.adrian at unibuc.ro
Thu Dec 3 10:56:17 CET 2015


On Wed, Dec 2, 2015 at 10:38 PM, Michael Sumner <mdsumner at gmail.com> wrote:

>
> On Wed, 2 Dec 2015 at 23:10 Adrian Dușa <dusa.adrian at unibuc.ro> wrote:
>
>> 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?
>>
>>
> Try polypath with the evenodd rule (vs. the winding rule):
>

Oh, that is sweet!
I didn't even know about the polypath() function. Time to study now...

Thanks a lot!
Adrian

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

	[[alternative HTML version deleted]]



More information about the R-help mailing list