antipolygon: Fill the complement of a polygon

Description Usage Arguments Details Value Note Author(s) See Also Examples

Description

Fill a plot with a color outside the confines of a polygon.

Usage

1
antipolygon(x, y, col = 0, corner=1, pct=.4)

Arguments

x

x coordinates of polygon

y

y coordinates of polygon

col

Fill color

corner

Corner on the plot to connect to at the end: 1 = LowerLeft(default) ; 2:UpperLeft 3 = UpperRight; 4=LowerRight

pct

Decimal percent of usr coordinates to expand beyond the polygon

Details

antipolygon uses par("usr") to determine the external bounds of plotting region. Corners are labels from bottom left counter-clockwise, 1-4.

Value

Used for graphical side effect

Note

If the figure is resized after plotting, filling may not appear correct.

Author(s)

Jonathan M. Lees <jonathan.lees@unc.edu>

See Also

polygon, par

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
x = runif(100)
y = runif(100)

#########  some data points to plot:

plot(x,y)
###########   create polygon:
pp =list(x=c(0.231,0.316,0.169,0.343,0.311,0.484,0.757,
         0.555,0.800,0.563,0.427,0.412,0.203),
     y=c(0.774,0.622,0.401,0.386,0.138,0.312,0.200,0.459,
        0.658,0.624,0.954,0.686,0.813))

polygon(pp)

antipolygon(x=pp$x, y=pp$y,col='blue')
####  where as this does not look so good
plot(x,y)
antipolygon(x=pp$x, y=pp$y,col='blue', corner=2)

GEOmap documentation built on May 2, 2019, 8:56 a.m.