Learn R Programming

hydroEvents (version 0.12.0)

plotPairs: Plot Paired Events

Description

Wrapper function for plotting paired events.

Usage

plotPairs(
  data.1,
  data.2,
  events,
  dates = NULL,
  type = "hyet",
  color.list = rainbow(nrow(events)),
  xlab = "",
  ylab.1 = "",
  ylab.2 = "",
  cex.2 = 1,
  main = ""
)

Value

No return value.

Arguments

data.1

The first data vector

data.2

The second data vector

events

The paired events data frame from pairEvents

dates

Optional date vector

type

The type of plot (see details)

color.list

Vector of colours used for plotting

xlab

x-axis label

ylab.1

primary y-axis label

ylab.2

secondary y-axis label

cex.2

cex for secondary y-axis label

main

Plot title

Details

If the type is "hyet" then data.1 is plotted as a vertical lines and data.2 as a line. If the type is "lineover" then all data is plotted as lines.

See Also

pairEvents

Examples

Run this code
library(hydroEvents)
BFI_res = eventBaseflow(dataBassRiver)
POT_res = eventPOT(dataLoch)
pairs.1 = pairEvents(POT_res, BFI_res, type = 1, lag = 5)
pairs.3 = pairEvents(POT_res, BFI_res, type = 3, lag = 3)
d = as.Date("1974-06-30") + 0:(length(dataBassRiver)-1)
oldpar <- par(mar = c(3, 3.5, 2, 3.5), mfrow = c(2, 1))
plotPairs(dataLoch, dataBassRiver, pairs.1, dates = d, type = "hyet", xlab = "Date",
    ylab.1 = "Rain (mm)", ylab.2 = "Flow (ML/day)", main = "Matching Forward")
plotPairs(dataLoch, dataBassRiver, pairs.3, dates = d, type = "hyet", xlab = "Date",
    ylab.1 = "Flow (ML/day)", ylab.2 = "Rain (mm)", main = "Matching Backward")
par(oldpar)

Run the code above in your browser using DataLab