| nr_line | R Documentation |
Uses Bresenham's algorithm to draw lines. No antialiasing.
nr_line(nr, x1, y1, x2, y2, color = "black", linewidth = 1, use_alpha = TRUE)
nr |
native raster image |
x1, y1, x2, y2 |
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 |
linewidth |
Line linewidth. Default: 1. If |
use_alpha |
Use alpha channel when drawing? Logical. Default: TRUE |
Invisibly return the supplied native raster image which was been modified in-place
w <- 200
h <- 150
nr <- nr_new(w, h, 'grey80')
N <- 40
nr_line(
nr,
x1 = seq(0, 2*w, length.out = N), y1 = 0,
x2 = 0, y2 = seq(0, 2 * h, length.out = N),
color = rainbow(N)
)
plot(nr)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.