Add SpatVector data to a plot (map) with points
, lines
, or polys
.
These are simpler alternatives for plot(x, add=TRUE)
# S4 method for SpatVector
points(x, col, cex=1, pch=20, ...)# S4 method for SpatVector
lines(x, y=NULL, col, lwd=1, lty=1, arrows=FALSE, ...)
# S4 method for SpatVector
polys(x, col, border="black", lwd=1, lty=1, ...)
# S4 method for SpatExtent
points(x, col, ...)
# S4 method for SpatExtent
lines(x, col, ...)
SpatVector or SpatExtent
missing or SpatVector. If both x
and y
have point geometry and the same number of rows, lines are drawn between pairs of points
character. Colors
character. color(s) of the polygon borders. Use NULL
or NA
to not draw a border
numeric. point size magnifier. See par
positive integer, line type. See points
numeric, line-width. See par
positive integer, line type. See par
logical. If TRUE
and y
is a SpatVector, arrows are drawn intead of lines. See ?arrows
for additional arguments
additional graphical arguments such as lwd
, cex
and pch
# NOT RUN {
f <- system.file("ex/lux.shp", package="terra")
v <- vect(f)
r <- rast(v)
values(r) <- 1:ncell(r)
plot(r)
lines(v)
points(v)
# }
Run the code above in your browser using DataLab