plot.class_vector_cube: Plot Segments

View source: R/sits_plot.R

plot.class_vector_cubeR Documentation

Plot Segments

Description

Plot vector classified cube

Usage

## S3 method for class 'class_vector_cube'
plot(
  x,
  ...,
  tile = x$tile[[1]],
  legend = NULL,
  seg_color = "black",
  line_width = 0.5,
  palette = "Spectral",
  tmap_options = NULL
)

Arguments

x

Object of class "segments".

...

Further specifications for plot.

tile

Tile to be plotted.

legend

Named vector that associates labels to colors.

seg_color

Segment color.

line_width

Segment line width.

palette

Alternative RColorBrewer palette

tmap_options

Named list with optional tmap parameters max_cells (default: 1e+06) scale (default: 0.5) graticules_labels_size (default: 0.7) legend_title_size (default: 1.0) legend_text_size (default: 1.0) legend_bg_color (default: "white") legend_bg_alpha (default: 0.5)

Value

A plot object with an RGB image or a B/W image on a color scale using the pallete

Note

To see which color palettes are supported, please run

Author(s)

Gilberto Camara, gilberto.camara@inpe.br

Examples

if (sits_run_examples()) {
    data_dir <- system.file("extdata/raster/mod13q1", package = "sits")
    cube <- sits_cube(
        source = "BDC",
        collection = "MOD13Q1-6",
        data_dir = data_dir
    )
    # segment the image
    segments <- sits_segment(
        cube = cube,
        output_dir = tempdir()
    )
    # create a classification model
    rfor_model <- sits_train(samples_modis_ndvi, sits_rfor())
    # classify the segments
    probs_segs <- sits_classify(
        data = segments,
        ml_model = rfor_model,
        output_dir = tempdir()
    )
    #
    # Create a classified vector cube
    class_segs <- sits_label_classification(
        cube = probs_segs,
        output_dir = tempdir(),
        multicores = 2,
        memsize = 4
    )
    # plot the segments
    plot(class_segs)
}

e-sensing/sits documentation built on Jan. 28, 2024, 6:05 a.m.