Skip to contents

Computes the area (km²) and the relative share (%) of each LCZ class, and optionally draws a bar, pie or donut chart.

Usage

lcz_cal_area(
  x,
  plot_type = c("bar", "pie", "donut"),
  iplot = TRUE,
  isave = FALSE,
  save_extension = "png",
  show_legend = TRUE,
  inclusive = FALSE,
  xlab = NULL,
  ylab = NULL,
  ...,
  lang = "en"
)

Arguments

x

A SpatRaster (or path) with LCZ classes (1-17).

plot_type

One of "bar" (default), "pie" or "donut".

iplot

Logical. Return the plot (TRUE) or the summary table (FALSE).

isave

Logical. Save the plot and the summary table in LCZ4r_output/.

save_extension

Image format: "png", "jpg", "tif", "pdf" or "svg".

show_legend

Logical. Show the legend.

inclusive

Logical. Use the colour-vision-deficiency-safe palette.

xlab, ylab

Axis labels. Sensible translated defaults are used when NULL.

...

Passed to ggplot2::labs() (e.g. title, subtitle, caption).

lang

Language used for labels, messages and errors. See lcz_langs(). Defaults to "en".

Value

A summary tibble (iplot = FALSE) or a ggplot object.

References

Stewart, I. D., and Oke, T. R. (2012). Local Climate Zones for urban temperature studies. Bull. Amer. Meteor. Soc. 93(12) 1879-1900. doi:10.1175/BAMS-D-11-00019.1

Examples

if (FALSE) { # \dontrun{
my_lcz_map <- lcz_get_map(city = "Juiz de Fora")
lcz_cal_area(my_lcz_map, plot_type = "bar")
lcz_cal_area(my_lcz_map, plot_type = "donut", lang = "pt")
lcz_cal_area(my_lcz_map, iplot = FALSE)
} # }