PlotDurationCurve: Plot duration curves

View source: R/function_PlotDurationCurve.R

PlotDurationCurveR Documentation

Plot duration curves

Description

Convenience wrapper function for a (multiple) line plot, with pretty defaults for axis annotation and a Gaussian scaling option for the x-axis.

Usage

PlotDurationCurve(
  freq,
  xscale = "lin",
  yscale = "log",
  add.legend = FALSE,
  l.legend = NULL,
  ylim = NULL,
  xlab = "Flow exceedance percentile",
  ylab = "m3s",
  col = "blue",
  lty = 1,
  lwd = 1,
  mar = c(3, 3, 1, 1) + 0.1
)

Arguments

freq

Data frame with at least two columns, containing probabilities in the first and series of data quantiles in the remaining columns. Typically an object as returned by ExtractFreq or a subset thereof.

xscale

Character string, keyword for x-axis scaling. Either "lin" for linear scaling or "gauss" for gaussian scaling as in a normal probability plot, which allows for for better comparison of low flow and high flow frequencies.

yscale

Character string, keyword for y-axis scaling. Either "lin" for linear scaling or "log" for common logarithm scaling.

add.legend

Logical. If TRUE, a legend will be added to the plot, including the number of observations on which the quantiles are based for each curve if freq is a result from ExtractFreq.

l.legend

Character vector. If non-NULL, legend labels are read from here instead of from column names in freq.

ylim

Numeric vector of length two, giving y-axis limits. NULL for default values.

xlab

Character string, x-axis label.

ylab

Character or plotmath expression string. Y-axis label, either as keyword "m3s" or "mmd" for pre-defined pretty discharge labels, or any other string which will be plotted unchanged.

col

Line color specification, see par for details. Defaults to blue. Either a single value or a vector of the same length as quantile series in freq.

lty

Line type specification, see par for details. Either a single value or a vector of the same length as quantile series in freq.

lwd

Line width specification, see par for details. Either a single value or a vector of the same length as quantile series in freq.

mar

Numeric vector of length 4, margin specification as in par with modified default. Details see there.

Details

PlotDurationCurve plots a duration curve with pretty formatting defaults. The function sets par parameters tcl and mgp internally and will override previously set values for the returned plot. It typically uses results from ExtractFreq as input data and via that function it can be used to visualize and compare time series properties.

Value

PlotDurationCurve returns a plot to the currently active plot device.

See Also

ExtractFreq

Examples

# Import source data
te1 <- ReadBasinOutput(filename = system.file("demo_model", "results", "0003587.txt", 
                       package = "HYPEtools"))
te2 <- ExtractFreq(te1[, c("COUT", "ROUT")])
# Plot flow duration curves for simulated and observed discharge
PlotDurationCurve(freq = te2, add.legend = TRUE, col = c("red", "blue"))


rcapell/HYPEtools documentation built on Feb. 28, 2024, 2:29 p.m.