Make either a histogram or boxplot showing the number of pixels in each polygon of an sf object

plot_resolution(
  plot_type,
  covariates,
  shape,
  resolution,
  original_resolution = NULL
)

Arguments

plot_type

character. Either histogram or boxplot

covariates

SpatRaster. The covariates

shape

sf. The response data

resolution

character. Either original or low

original_resolution

list. Containing the resolution of the width and height of the original data. Default NULL.

Value

A plotly object

Examples

raster <- terra::rast(system.file("extdata", "covariates", "EVI.tif", package = "disagapp"))
shape <- sf::st_read(system.file("extdata", "shapes", package = "disagapp"))
#> Reading layer `mdg_shapes' from data source 
#>   `/home/runner/work/_temp/Library/disagapp/extdata/shapes' using driver `ESRI Shapefile'
#> Simple feature collection with 109 features and 16 fields
#> Geometry type: MULTIPOLYGON
#> Dimension:     XY
#> Bounding box:  xmin: 43.19138 ymin: -25.60895 xmax: 50.48378 ymax: -11.94543
#> Geodetic CRS:  WGS 84
plot_resolution("histogram", raster, shape, "low")