Plot (that is, make a map of) the values of a SpatRaster or SpatVector
# S4 method for SpatRaster,numeric
plot(x, y, cols, maxcell=100000, leg.mar,
leg.levels=5, leg.shrink=c(0,0), leg.main=NULL, leg.main.cex=1, leg.ext,
digits, useRaster=TRUE, zlim, xlab="", ylab="", ...)# S4 method for SpatRaster,missing
plot(x, y, maxcell=100000, nc, nr, main, maxnl=16, ...)
# S4 method for SpatRaster,SpatRaster
plot(x, y, maxcell=100000, nc, nr, maxnl=16, gridded=FALSE, ncol=25, nrow=25, ...)
# S4 method for SpatRaster
image(x, y, maxcell=100000, xlab="", ylab="", useRaster=TRUE, ...)
# S4 method for SpatVector,missing
plot(x, y, xlab="", ylab="", ...)
# S4 method for SpatVector
points(x, ...)
# S4 method for SpatVector
lines(x, ...)
# S4 method for SpatExtent
lines(x, ...)
SpatRaster or SpatVector
missing or integer indicating the layer(s) to be plotted
character. colors
integer > 0. Maximum number of cells to use for the plot
integer > 0. size of margin for the legend
integer > 0. number of labels on the legend
numeric. relative shrinkage of legend from top and bottom
character. legend title
character. legend title size
SpatExtent or numeric vector indicating the area where to plot the legend. The vector should have a lenght of 4 (xmin, xmax, ymin, ymax)
integer >= 0
range of allowed values
character
character
logical; if TRUE
plotting is faster because a bitmap raster is used to plot the image instead of polygons. See image
integer > 0. Optional. The number of columns to divide the plotting device in (when plotting multiple layers in a RasterLayer or RasterBrick object)
integer > 0. Optional. The number of rows to divide the plotting device in (when plotting multiple layers in a RasterLayer or RasterBrick object)
integer > 0. Maximum number of layers to plot (for a multi-layer object)
character. Main plot title
logical. If TRUE
the scatterplot is gridded (counts by cells)
integer. Number of columns for gridding
integer. Number of rows for gridding
additional graphical arguments
# NOT RUN {
f <- system.file("exdata/test.tif", package="terra")
r <- rast(f)
plot(r)
d <- (r > 400) + (r > 600)
plot(d, leg.main="Title")
plot(d, leg.ext=c(178000,178200,332800,333250),
leg.main=c("Title \n\n"))
f <- system.file("exdata/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