| nr_polyline | R Documentation |
Draw a polyline on a native raster image
nr_polyline(
nr,
x,
y,
color = "black",
linewidth = 1,
mitre_limit = linewidth,
close = FALSE,
use_alpha = TRUE
)
nr |
native raster image |
x, y |
Vectors of point coordinates |
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. |
close |
Should the polyline be closed? I.e. should a line be drawn between the last point and the first point? Default: FALSE |
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_polygon(),
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_polyline(nr, xs, ys)
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.