Uses Bresenham's algorithm to draw lines. No antialiasing.
nr_line(nr, x0, y0, x1, y1, color = "black")
Arguments
- nr
nativeRaster
- x0, y0, x1, y1
Vectors of coordinates of endpoints of line
- 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_line(nr, x0 = c(0, N-1), y0 = c(0, 0), x1 = c(N-1, 0), y1 = c(N-1, N-1),
color = c('red', 'black'))
plot(nr)