| nr_polygon | R Documentation |
Draw multiple polygons on a native raster image
nr_polygon(
nr,
x,
y,
id = NULL,
fill = "black",
color = NA,
linewidth = 1,
mitre_limit = linewidth,
use_alpha = TRUE
)
nr |
native raster image |
x, y |
Vectors of point coordinates |
id |
integer vector used to separate coordinates into
multiple polygons. Consecutive runs of the same |
fill |
fill color |
color |
Color as a character string. Either a standard R color
(e.g. 'blue', 'white')
or a hex color of the form |
linewidth |
Line linewidth. Default: 1. If |
mitre_limit |
Limit the size of the mitre when two lines meet at an acute angle and linewidth is greater than 1. Default: same as line linewidth which mostly looks OK. |
use_alpha |
Use alpha channel when drawing? Logical. Default: TRUE |
Invisibly return the supplied native raster image which was been modified in-place
Other drawing functions:
nr_circle(),
nr_polyline(),
nr_rect(),
nr_tri_mesh()
w <- 200
h <- 150
nr <- nr_new(w, h, 'grey80')
N <- 20
theta <- seq(0, 2 * pi, length.out = N)
xs <- w/2 + 50 * cos(theta)
ys <- h/2 + 50 * sin(theta)
nr_polygon(nr, xs, ys, fill = 'grey50', col = 'black')
nr_point(nr, xs, ys, col = 'red')
plot(nr)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.