ch_gg_hydrographs: Hydrographs for WSC stations using 'ggplot2'

View source: R/ch_gg_hydrographs.R

ch_gg_hydrographsR Documentation

Hydrographs for WSC stations using ggplot2

Description

Acquires and plots values for WSC streamflows, using ggplot2. The existing functions ch_qa_hydrograph and ch_model_hydrograph use basic R plotting, require other functions to assemble the values, and only plot values for a single station. This function is able to plot hydrographs for more than one station, which may be useful, particularly when comparing responses for several streams in the same region.

Usage

ch_gg_hydrographs(
  WSC_stations,
  daily = TRUE,
  instantaneous = FALSE,
  facets = TRUE,
  common_dates = FALSE,
  start_date = NULL,
  end_date = NULL,
  hydat_path = NULL,
  inst_colour = "black",
  daily_colour = "black",
  ...
)

Arguments

WSC_stations

Required. A vector of WSC station numbers.

daily

Optional. If TRUE, mean daily streamflows are plotted as stair-steps.

instantaneous

Optional. If TRUE, annual instantaneous peak flows are plotted as points.

facets

Optional. If TRUE, the plot is faceted by station number.

common_dates

Optional. If TRUE, a common date range is used for all time series.

start_date

Optional. If specified (format = yyyy-mm-dd), only values on or following the date are plotted.

end_date

Optional. If specified (format = yyyy-mm-dd), only values on or before the date are plotted.

hydat_path

Optional. Path to the HYDAT database. Usually omitted unless you want to use a specific database file.

inst_colour

Optional. Colour to be used for annual instantaneous peaks, if either facetted or only a single station is plotted. Default is "black".

daily_colour

Optional. Colour to be used for daily flows, if either facetted or only a single station is plotted. Default is "black".

...

Other parameters for the ggplot facets, if specified.

Value

Returns a ggplot2 object of the hydrographs.

Author(s)

Kevin Shook

See Also

ch_qa_hydrograph ch_model_hydrograph

Examples

 ## Not run: 
# Not run as this requires the installation of the HYDAT database

# plot a single station
stations <- c("05HH003")
p <- ch_gg_hydrographs(stations, daily = TRUE, instantaneous = TRUE)

# plot a group of stations in a region, as all appear to be responding to the same event
stations <-  c("05CC001", "05CC011", "05CD006", "05CD007", "05CE002", "05CE006", 
"05CE010", "05CE012", "05CE018", "05CE020", "05CG004", "05CG006")

p <- ch_gg_hydrographs(stations, daily = TRUE, instantaneous = FALSE, 
common_dates = FALSE, start_date = "2011-06-01", end_date = "2011-06-30", 
facets = TRUE, scales = "free_y", ncol= 3)

## End(Not run)

CSHShydRology documentation built on Feb. 4, 2026, 5:06 p.m.