Learn R Programming

terra (version 0.8-6)

plotVector: Plot a SpatVector

Description

Plot (that is, make a map of) using a SpatVector

Usage

# S4 method for SpatVector,missing
plot(x, y, col, 
   axes=TRUE, add=FALSE, ...)

# S4 method for SpatVector,character plot(x, y, col, type, mar=c(5.1, 4.1, 4.1, 7.1), axes=TRUE, add=FALSE, ...)

# S4 method for SpatExtent,missing plot(x, y, col, ...)

# S4 method for SpatVector points(x, col, ...)

# S4 method for SpatVector lines(x, col, ...)

# S4 method for SpatExtent points(x, col, ...)

# S4 method for SpatExtent lines(x, col, ...)

Arguments

x

SpatVector

y

missing or positive integer indicating the layer(s) to be plotted, or the name of the layer to be mapped

col

character. Colors

type

character. Type of map/legend. One of "continuous", "classes", or "internval"

axes

logical. Draw axes?

mar

numeric vector of lenght 4 to set the margins of the plot (to make space for the legend)

add

logical. If TRUE add the object to the current plot (for points, lines, and polygons this is an alternative to the lines or points methods

...

additional graphical arguments

Examples

Run this code
# NOT RUN {
f <- system.file("ex/lux.shp", package="terra")
v <- vect(f)
plot(v)
plot(v, "ID_1")

r <- rast(v)
values(r) <- 1:ncell(r)
plot(r)
lines(v)
points(v)
# }

Run the code above in your browser using DataLab