BoxplotSLCClasses: Box plots of SLC distributions

View source: R/function_BoxplotSLCClasses.R

BoxplotSLCClassesR Documentation

Box plots of SLC distributions

Description

BoxplotSLCClasses plots SLC class distributions for all SUBIDs in a GeoData data frame as boxplots. Boxes can represent distributions of area fractions

Usage

BoxplotSLCClasses(
  gd,
  gcl,
  col.landuse = "rainbow",
  col.group = NULL,
  lab.legend = NULL,
  pos.legend = 1,
  abs.area = FALSE,
  log = "",
  ylim = NULL,
  range = 0,
  mar = c(3, 3, 1, 7) + 0.1,
  mgp = c(1.5, 0.2, 0),
  tcl = 0.1,
  xaxs = "i",
  xpd = TRUE
)

Arguments

gd

Data frame containing columns with SLC fractions, typically a 'GeoData.txt' file imported with ReadGeoData.

gcl

Data frame containing columns with SLCs and corresponding land use and soil class IDs, typically a 'GeoClass.txt' file imported with ReadGeoClass.

col.landuse

Specification of colors for box outlines, to represent land use classes. Either a keyword character string, or a vector of colors with one element for each land use class as given in argument gcl in ascending order. Possible keywords are 'rainbow' (default) or 'auto'. 'rainbow' triggers a generation of land use class colors using the rainbow palette. 'auto' triggers generation of a pretty color palette with similar colors for land use groups. This option requires specification of land use groups in argument col.group.

col.group

Integer vector of the same length as the number of land use classes given in gcl. Specifies a land use group ID for each land use class ID, in ascending order. Groups and group IDs to use (in parentheses):

  • Water, snow, and ice (1)

  • Urban (2)

  • Forests (3)

  • Agriculture and pastures (4)

  • Natural non-forested (5)

lab.legend

Character string giving optional land use and soil class names to label the legend. Land use classes first, then soil classes. Both following class IDs as given in gcl in ascending order.

pos.legend

Numeric, legend position in x direction. Given as position on the right hand outside of the plot area in x-axis units.

abs.area

Logical, if TRUE, boxes will be plotted for absolute areas instead of area fractions.

log

Character string, passed to boxplot. Empty string for linearly scaled axes, 'y' for log scaled y-axis (particularly in combination with abs.area = TRUE).

ylim

Numeric vector of length 2, y-axis minimum and maximum. Set automatically if not specified.

range

Argument to boxplot with changed default. See documentation in there.

mar, mgp, tcl, xaxs, xpd

Arguments passed to par. See documentation in there.

Details

BoxplotSLCClasses allows to analyze the occurrence of individual SLCs in a given model set-up. both in terms of area fractions (SLC values) and absolute areas. The function uses boxplot to plot distributions of SLCs of all SUBIDs in a GeoData data frame. Land use classes are color-coded, and soil classes marked by a point symbol below each box. Box whiskers extend to the data extremes.

Value

BoxplotSLCClasses returns a plot to the currently active plot device, and invisibly a data frame of SLC class fractions with 0 values replaced by NAs. If absolute areas are plotted, these are returned in the data frame.

Note

There is a maximum of 26 symbols available for marking soil classes. BoxplotSLCClasses can be quite crowded, depending on the number of SLCs in a model set-up. Tested and recommended plot device dimensions are 14 x 7 inches (width x height), e.g.:

> x11(width = 14, height = 7)

> png("mySLCdistri.png", width = 14, height = 7, units = "in", res = 600)

Examples

# Import source data
te1 <- ReadGeoData(filename = system.file("demo_model", "GeoData.txt", package = "HYPEtools"))
te2 <- ReadGeoClass(filename = system.file("demo_model", "GeoClass.txt", package = "HYPEtools"))
BoxplotSLCClasses(gd = te1, gcl = te2)


HYPEtools documentation built on Sept. 11, 2024, 8:34 p.m.