compare_grids: Compare two or more grids

View source: R/spatial.R

compare_gridsR Documentation

Compare two or more grids

Description

Compare two or more grids

Usage

compare_grids(
  ...,
  polygons = NULL,
  colors = NULL,
  shapes = NULL,
  point_size = 1,
  polygon_color = "#2C3E50",
  title = "Grid Comparison"
)

Arguments

...

Named data frames with longitude and latitude columns

polygons

Optional sf object to show polygon boundaries

colors

Named vector of colors for each grid

shapes

Named vector of point shapes for each grid

point_size

Size of grid points

polygon_color

Color for polygon boundaries

title

Plot title

Value

ggplot object

Examples


grid <- expand.grid(longitude = seq(72.5, 77.5, by = 1), latitude = seq(18.5, 21.5, by = 1))
grid$temperature <- seq_len(nrow(grid))
cells <- sf::st_make_grid(sf::st_as_sfc(sf::st_bbox(
  c(xmin = 72, ymin = 18, xmax = 78, ymax = 22),
  crs = 4326
)), n = c(2, 1))
polys <- sf::st_sf(region = c("west", "east"), geometry = cells)
coarse <- grid[grid$longitude < 75, ]
compare_grids(fine = grid, coarse = coarse, polygons = polys)


varunayan documentation built on Oct. 30, 2026, 1:07 a.m.