Draw multiple polygon on a nativeRaster image

nr_polygon(nr, x, y, id = NULL, fill = "black", color = NA)

Arguments

nr

nativeRaster

x, y

Vectors of point coordinates

id

integer vector used to separate coordinates into multiple polygons. Consecutive runs of the same id value belong to the same polygon. If NULL (the default) then all coordinates are assumed to be vertices of a single polygon.

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 #rrggbbaa, #rrggbb, #rgba or #rgb

Value

Original nativeRaster modified in-place

Examples

N <- 20
nr <- nr_new(N, N, 'grey80')
nr_polygon(nr, x = c(0, N-1, 0), y = c(0, 0, N-1), fill = 'blue', color = 'red')
plot(nr)