plot_diff: Plot raster difference

View source: R/plot_diff.R

plot_diffR Documentation

Plot raster difference

Description

Plot difference (absolute and relative) of A - B single layer raster objects

Usage

plot_diff(
  a,
  b,
  file_a,
  file_b,
  var = "",
  map,
  operation = mean,
  col,
  col_1,
  col_2,
  title = "",
  units_1 = expression(kton ~ yr^-1),
  units_2 = expression("%"),
  lim_1 = NA,
  lim_2 = NA,
  lines_1,
  lines_2,
  save,
  w = 800,
  h = 1200,
  pt = 18,
  int = 10,
  grid_int = 15,
  grid_lat_min = -80,
  grid_lat_max = 80,
  force_max,
  ndig = 2,
  ...
)

Arguments

a

raster A

b

raster B

file_a

file for raster A

file_b

file for raster B

var

sub title 1 and variable to be open for file_a and file_b

map

map passed to eixport::wrf_raster

operation

function passed to calc, default is mean

col

color scale

col_1

color for primary map

col_2

color for secondary map and grid

title

main title

units_1

units suptitle for absolute difference

units_2

units suptitle for relative difference

lim_1

limits for absolute difference

lim_2

limits for relative difference

lines_1

primary map (sf class lines)

lines_2

secondary map (sf class lines)

save

TRUE to save with automatic name, or a filename

w

width for png function

h

height for png function

pt

fond size for png function

int

interval for latitude and logitude axis

grid_int

int passed to project_grid function

grid_lat_min

min_lat passed to project_grid function

grid_lat_max

max_lat passed to project_grid function

force_max

module of upper and lower limits for percentage plot

ndig

number of digits for lengend_range

...

arguments passed to raster_plot

Examples

us    <- sf::read_sf(paste0(system.file("extdata",package="hackWRF"),"/us.shp"))
coast <- sf::read_sf(paste0(system.file("extdata",package="hackWRF"),"/coast.shp"))
A     <- readRDS(paste0(system.file("extdata",package="hackWRF"),"/rasterA.Rds"))
B     <- readRDS(paste0(system.file("extdata",package="hackWRF"),"/rasterB.Rds"))

plot_diff(a = A, b = B,
          lines_1 = coast, lines_2 = us,
          var = 'E_PM25J', title = 'A - B',
          lim_1 = 0.00001,lim_2 = 1)


Schuch666/hackWRF documentation built on June 9, 2025, 1:46 p.m.