
Preview a lazy object, a collected array, or a raster file.
preview.RdA quick, informative plot: single band as a colour ramp with a legend, three
bands as a stretched RGB composite, categorical data (few distinct values)
with discrete colours. Nodata is transparent; a percentile stretch sets the
colour range; axes come from the grid.
Usage
preview(
x,
bands = NULL,
max_px = NULL,
stretch = c(2, 98),
col = grDevices::hcl.colors(64, "Viridis"),
legend = NULL,
main = "",
axes = TRUE,
xlab = "",
ylab = "",
na_col = NULL,
...
)Arguments
- x
A
LazyRaster,LazyDataset, a matrix/array fromcollect(), or a path to a raster file.- bands
Bands to show: 1 for a colour ramp, 3 for RGB. For a
LazyDataset, band names are also accepted. Defaults to the first 3 bands (RGB) or band 1.- max_px
Longest-axis pixel budget for the render; defaults to the device size.
- stretch
Percentile cut
c(low, high)for the colour range, orNULLfor min/max.- col
Colour ramp for single-band plots.
- legend
Draw a legend? Defaults to
TRUEfor single band,FALSEfor RGB.- main, axes, xlab, ylab
Plot title, axes toggle, and axis labels.
- na_col
Colour for nodata pixels, or
NULL(default) to leave them transparent. Useful to make a mask's footprint explicit.- ...
Unused.