Learn R Programming

clc (version 1.0.0)

plot_clc: Plot CLC Layer

Description

Plot CLC data stored in objects of supported classes. The function adapts the plot based on the class of the input data (vectorial or raster format).

Usage

plot_clc(clo, ...)

# S3 method for clc plot_clc(clo, ...)

# S3 method for clc_raster plot_clc(clo, ...)

Value

A `ggplot2` object or a `terra` plot.

Arguments

clo

An object containing CLC data. This must be an instance of a supported class, such as: - A vectorial CLC data object (e.g., `clc` object). - A raster CLC data object (e.g., `clc_raster`).

...

Additional arguments passed to the `terra::plot` function.

Details

For the raster version, the `terra::plot` function is used with the `col` parameter configured, while all other parameters supported by the function can also be defined (using `...`).

For the vector version, `ggplot2::ggplot` is used, and by using the `prepare_plot` function instead of this one (`plot_clc`), further customization can be applied as needed.

See Also

prepare_plot

Other CLC class functions: as_raster(), clc(), copy_to(), cut_to_extent(), get_colors.clc(), get_levels.clc(), get_raster(), prepare_plot(), save_to()

Examples

Run this code
source_gpkg <- system.file("extdata", "clc.gpkg", package = "clc")
clo <- clc(source = source_gpkg, layer_name = "clc")

temp_file <- tempfile(fileext = ".png")
png(filename = temp_file, width = 800, height = 600)

clo |>
  plot_clc()

dev.off()

Run the code above in your browser using DataLab