source_gpkg <- system.file("extdata", "clc.gpkg", package = "clc")
clo <- clc(source = source_gpkg, layer_name = "clc")
p <- clo |>
prepare_plot()
levels <- clo |>
get_levels()
p <- p +
ggplot2::scale_fill_manual(
values = stats::setNames(levels$color, levels$id),
labels = stats::setNames(levels$description, levels$id),
name = ""
) +
ggplot2::theme(
legend.position = "right",
legend.key.height = ggplot2::unit(2, "cm"),
legend.title = ggplot2::element_text(size = 12),
legend.text = ggplot2::element_text(size = 10)
) +
ggplot2::theme_minimal()
temp_file <- tempfile(fileext = ".png")
png(filename = temp_file, width = 800, height = 600)
p
dev.off()
Run the code above in your browser using DataLab