Skip to contents

Custom difference (x - y) plots for SpatRaster object (based on terra package)

Usage

plot_diff(
  x,
  y,
  col,
  absolute = TRUE,
  relative = TRUE,
  lim_1 = NA,
  lim_2 = NA,
  unit = c(units(x), expression("%")),
  ...
)

Arguments

x

SpatVector points

y

values to plot

col

color

absolute

to plot absolute difference

relative

to plot relative difference

lim_1

range of values for scale

lim_2

calculate symmetrical scale

unit

annotation for units

...

arguments to be passing to plot_raster

Value

No return value

Examples


folder <- system.file("extdata",package="eva3dm")
wrf    <- paste0(folder,"/wrfinput_d01")
A      <- wrf_rast(wrf,'XLAT')
terra::units(A) <- 'degrees'
B      <- wrf_rast(wrf,'XLONG')
plot_diff(A,B,int = 2)