Skip to contents

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

Usage

plot_diff(
  x,
  y,
  col,
  absolute = FALSE,
  relative = FALSE,
  lim_a = NA,
  lim_r = NA,
  asymmetric = FALSE,
  scale,
  unit = c(units(x), expression("%")),
  fill = FALSE,
  ...
)

Arguments

x

SpatVector points

y

values to plot

col

color

absolute

to plot absolute difference

relative

to plot relative difference

lim_a

range of values for absolute scale

lim_r

range of values for relative scale

asymmetric

to alow asymmetric scales (different positive and negative limits)

scale

variable multiplier for absolute difference

unit

annotation for units

fill

filling NAs

...

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)
#> [1] "test"