Skip to contents

Custon plot for SpatRaster (terra R-package) object based on terra package

Usage

overlay(
  p,
  z,
  col,
  lim = range(z, na.rm = TRUE),
  symmetry = TRUE,
  pch = 19,
  cex = 1,
  outside = TRUE,
  add = TRUE,
  plg = list(tic = "none", shrink = 1),
  pax = list(),
  expand = 1.15,
  ...
)

Arguments

p

SpatVector points

z

column name or a vector of values to plot

col

color

lim

range of values for scale

symmetry

calculate symmetrical scale

pch

type of point

cex

character expansion for the points

outside

to include values outside range

add

add to existing plot

plg

list of parameters passed to terra::add_legend

pax

list of parameters passed to graphics::axis

expand

to expand the plot region

...

arguments to be passing to terra::plot

Examples

sp<- terra::vect(paste0(system.file("extdata",package="eva3dm"),"/masp.shp"))
BR<- terra::vect(paste0(system.file("extdata",package="eva3dm"),"/BR.shp"))

p    <- readRDS(paste0(system.file("extdata",package="eva3dm"),"/sites_AQ_BR.Rds"))
p$id      <- row.names(p)
point     <- terra::vect(p)
point$NMB <- 1:45 - 20 # some values to plot

terra::plot(BR, main = 'add points',xlim = c(-52,-37),ylim = c(-25,-18))
terra::lines(BR)
terra::lines(sp, col = 'gray')
overlay(point,point$NMB,cex = 1.4)


overlay(point,point$NMB,cex = 1.4, add = FALSE, main = 'new plot')
terra::lines(BR)
terra::lines(sp, col = 'gray')