[R] Filling polygons with points
Duncan Murdoch
murdoch at stats.uwo.ca
Thu Oct 14 16:00:26 CEST 2004
On Thu, 14 Oct 2004 15:16:30 +0200, "Wolf, Michael"
<Michael.Wolf at bezreg-muenster.nrw.de> wrote :
>Dear list,
>
>are there any possibilities to fill a polygon with a point pattern or with a symbol pattern like '+' oder '-' instead of shading lines?
I don't think the graphics devices know how to do that, but you could
program it yourself:
Supposed interior(x,y) is a function that determines whether the
points (x,y) are in the polygon, then just create a grid of locations,
subset when interior(x,y) is true, and plot using pch='+'.
I made a quick search and was unable to find a general implementation
of the "interior" function for an arbitrary polygon; I'm a bit
surprised about that. Hopefully someone else can point to one,
otherwise please write one, and document it and contribute it to R.
It's a relatively standard algorithm, and would be useful.
Duncan Murdoch
More information about the R-help
mailing list