Skip to contents

plots a uncertainty cube

Usage

# S3 method for class 'uncertainty_cube'
plot(
  x,
  ...,
  tile = x[["tile"]][[1L]],
  roi = NULL,
  palette = "RdYlGn",
  rev = TRUE,
  scale = 1,
  first_quantile = 0.02,
  last_quantile = 0.98,
  max_cog_size = 1024L,
  legend_position = "inside"
)

Arguments

x

Object of class "probs_image".

...

Further specifications for plot.

tile

Tiles to be plotted.

roi

Spatial extent to plot (see note)

palette

An RColorBrewer or "cols4all" palette

rev

Reverse the color order in the palette?

scale

Scale to plot map (0.4 to 1.0)

first_quantile

First quantile for stretching images

last_quantile

Last quantile for stretching images

max_cog_size

Maximum size of COG overviews (lines or columns)

legend_position

Where to place the legend (default = "inside")

Value

A plot object produced showing the uncertainty associated to each classified pixel.

Note

To see which color palettes are supported, please run cols4all::c4a_gui(). The following optional parameters are available to allow for detailed control over the plot output:

  • graticules_labels_size: size of coord labels (default = 0.7)

  • legend_title_size: relative size of legend title (default = 1.0)

  • legend_text_size: relative size of legend text (default = 1.0)

  • legend_bg_color: color of legend background (default = "white")

  • legend_bg_alpha: legend opacity (default = 0.5)

#' To define a roi use one of:

  • A path to a shapefile with polygons;

  • A sfc or sf object from sf package;

  • A SpatExtent object from terra package;

  • A named vector ("lon_min", "lat_min", "lon_max", "lat_max") in WGS84;

  • A named vector ("xmin", "xmax", "ymin", "ymax") with XY coordinates.

Author

Gilberto Camara, gilberto.camara@inpe.br

Examples

if (sits_run_examples()) {
    # create a random forest model
    rfor_model <- sits_train(samples_modis_ndvi, sits_rfor())
    # create a data cube from local files
    data_dir <- system.file("extdata/raster/mod13q1", package = "sits")
    cube <- sits_cube(
        source = "BDC",
        collection = "MOD13Q1-6.1",
        data_dir = data_dir
    )
    # classify a data cube
    probs_cube <- sits_classify(
        data = cube, ml_model = rfor_model, output_dir = tempdir()
    )
    # calculate uncertainty
    uncert_cube <- sits_uncertainty(probs_cube, output_dir = tempdir())
    # plot the resulting uncertainty cube
    plot(uncert_cube)
}