Learn R Programming

RFOC (version 1.0-4)

antipolygon: Fill the complement of a polygon

Description

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

Usage

antipolygon(x, y, col = 0)

Arguments

x
x coordinates of polygon
y
y coordinates of polygon
col
Fill color

Value

  • Used for graphical side effect

Details

antipolygon uses par("usr") to determine the external bounds of plotting region.

See Also

polygon, par

Examples

Run this code
#########  some data points to plot:
x = runif(100)
y = runif(100)

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')

Run the code above in your browser using DataLab