plot_hydrograph: Hydrograph plot

View source: R/plot_hydrograph.R

plot_hydrographR Documentation

Hydrograph plot

Description

Creates a hydrograph with one or two streamflow data sets, and can include a precipitation hyetograph adapted form 'EcoHydRology'

Usage

plot_hydrograph(
  input = matrix(ncol = 2, nrow = 2),
  streamflow = input[, 2],
  timeSeries = input[, 1],
  streamflow2 = NULL,
  precip = NULL,
  begin = 1,
  endindex = length(streamflow),
  P.units = "",
  S.units = "",
  S1.col = "black",
  S2.col = "red",
  left_label = "Streamflow",
  right_label,
  streamflow3 = NULL,
  streamflow4 = NULL,
  precip2 = NULL
)

Arguments

input

This is a data frame with at least two columns of data First column: Must be a time/date series Second column: If including precip, precip. Otherwise, streamflow - AND do not include any other columns Third column: (Only include if precip is in the second column) First streamflow dataset Forth column: (optional) Second streamflow dataset

streamflow

vector of streamflow values - not necessary if using "input"

timeSeries

vector of time or date values - not necessary if using "input"

streamflow2

optional vector of streamflow values - not necessary if using "input"

precip

vector of precipitation values - not necessary if using "input"

begin

If you don't want to graph the whole data set, include the index where you would like to start

endindex

If you don't want to graph the whole dataset, include the index where you would like to end

P.units

Precipitation units (character)

S.units

Streamflow units (character). Users who have volumetric flow will have the superscript correctly formatted if they enter "m3s" or "ft3s"

S1.col

color of the line representing streamflow

S2.col

color of the line representing second streamflow data

left_label

Character for left label

right_label

Character for left label

streamflow3

optional vector of additional streamflow values

streamflow4

optional vector of additional streamflow values

precip2

optional vector of a second precip gage data if you are interested in comparing precip inputs

Value

ploted data object

Note

This function can now take NA values. If you chose to use the input argument but are not including precipitation, input must only have two columns - you will need to add the second streamflow dataset using the "streamflow2" argument.

Examples

## Not run: 
library(dataplot)

png("data/test.png")
rainfall <- dataplot::rainfall

plot_hydrograph(
  timeSeries = rainfall$`Date Time`,
  streamflow = rainfall$Discharge,
  precip = rainfall$`Rainfall depth (mm)`,
  S1.col = "red",
  left_label = "Discharge", S.units = "mm",
  right_label = "Rainfall", P.units = "mm"
)
dev.off()

## End(Not run)

eppofahmi/dataplot documentation built on Jan. 22, 2025, 1:14 a.m.