Skip to contents

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 class 'clc'
plot_clc(clo, ...)

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

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.

Value

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

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

Examples

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()
#> pdf 
#>   2