| compare_grids | R Documentation |
Compare two or more grids
compare_grids(
...,
polygons = NULL,
colors = NULL,
shapes = NULL,
point_size = 1,
polygon_color = "#2C3E50",
title = "Grid Comparison"
)
... |
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 |
ggplot object
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.