plot() plots an xarray object using [stars::plot()]

# S3 method for xarray.core.dataset.Dataset
plot(x, ...)

# S3 method for xarray.core.dataarray.DataArray
plot(x, ...)

Arguments

x

object which should be plotted

...

additional arguments passed to stars::plot()

Value

a stars plot

Examples

if (FALSE) { library(odcr) # connect to a database, store the Daatcube connection internally (default and recommended) database_connect(app = "Sentinel_2") # build a query list lat <- 22.821 lon <- 28.518 buffer <- 0.05 query <- list( 'time' = c('2020-01', '2020-03'), 'x' = c(lon - buffer, lon + buffer), 'y' = c(lat + buffer, lat - buffer), 'output_crs' = 'epsg:6933', 'resolution' = c(-20,20) ) # load data and return an xarray object for a query ds <- dc_load(query = c(product = "s2_l2a", dask_chunks = dict(), query)) # plot first timestamp, spatial subset and only first band/variable plot(ds[1,101:300,101:300][[1]]) # plot first timestamp, spatial subset and only two bands/variables plot(ds[1,101:300,101:300][[c(1,2)]]) }