plotPeaks {MGBT} | R Documentation |
Plot Peak Streamflows with Emphasis on Peak Discharge Qualification Codes
Description
Plot U.S. Geological Survey peak streamflows in peak_va
and discharge qualifications codes in the peak_cd
columns of a peak-streamflow data retrieval from the National Water Information System (NWIS) (U.S. Geological Survey, 2019). This code makes use of the add.log.axis
function from the lmomco package, and because this is the only instance of this dependency, the lmomco package is treated as a suggested package and not as a dependency for the MGBT package. The add.log.axis
function also is used for the basis of the logarithmic plot within the plotFFQevol
function.
This function accommodates the plotting of various nuances of the peak including less than (code 4), greater than (code 8), zero peaks (plotted by a green tick on the horizontal axis), and peaks that are missing but the gage height was available (plotted by a light-blue tick on the horizontal axis if the showGHyrs
argument is set). So-called code 5, 6, and 7 peaks are plotted by the numeric code as the plotting symbol, and so-called code C peaks are plotted by the letter “C.” The very unusual circumstances of codes 3 and O are plotted by the letters “D” (dam failure) and “O” (opportunistic), respectively. These codes are are summarized within splitPeakCodes
. The greater symbology set is described in the directory MGBT/inst/legend
of the package sources.
The logic herein also makes allowances for “plotting” gage-height only streamgages but this requires that the splitPeakCodes
function was called with the all_peak_na_okay
set to TRUE
. The gap analysis for gage-height only streamgages or streamgages for which the site changes from gage-height only to discharge and then back again or other permutations will likely result in the gap lines not being authoritative. The sub-bottom axis ticks for the gage-height only water years should always be plotting correctly.
Usage
plotPeaks(x, codes=TRUE, lot=NULL, site="",
xlab="", ylab="", xlim=NULL, ylim=NULL,
xlim.inflate=TRUE, ylim.inflate=TRUE, aux.y=NULL,
log.ticks=c(1, 2, 3, 5, 8),
show48=FALSE, showDubNA=FALSE, showGHyrs=TRUE, ...)
Arguments
x |
A |
codes |
A logical to trigger use of character plotting characters and not symbols; |
lot |
The low-outlier threshold, but if omitted, then |
site |
An optional character string for a plot title, and in practice, this is expected to be a streamgage location; |
xlab |
An optional x-label of the plot; |
ylab |
An optional y-label of the plot; |
xlim |
An optional x-limit of the plot; |
ylim |
An optional y-limit of the plot; |
xlim.inflate |
A logical to trigger nudging the horizontal axis left/right to the previous/future decade; |
ylim.inflate |
A logical to trigger nudging the vertical axis down/up to the nearest sane increment of log10-cycles. This inflation also includes a |
aux.y |
An optional set of values to pack into the data just ahead of the the vertical axis limits computation; |
log.ticks |
The argument |
show48 |
A logical, if |
showDubNA |
A logical, if set, will draw a |
showGHyrs |
A logical to trigger the light-blue special ticks for the water years having only gage height. The horizontal limits will be inflated accordingly if gage heights are outside the general discharge record; and |
... |
Additional arguments to pass to |
Value
No values are returned; this function is used for its graphical side effects.
Author(s)
W.H. Asquith
References
U.S. Geological Survey, 2019, USGS water data for the Nation: U.S. Geological Survey National Water Information System database, accessed October 11, 2019, at doi: 10.5066/F7P55KJN.
See Also
makeWaterYear
, splitPeakCodes
, plotFFQevol
Examples
# The dataRetrieval package is not required by MGBT algorithms.
# Note that makeWaterYear() is not needed because splitPeakCodes() requires
# the water_yr for gap analyses, and will call makeWaterYear() if it needs to.
PK <- dataRetrieval::readNWISpeak("08167000", convertType=FALSE)
PK <- splitPeakCodes(makeWaterYear(PK))
plotPeaks(PK, codes=TRUE, showGHyrs=FALSE,
xlab="Water year", ylab="Discharge, cfs") #
# The dataRetrieval package is not required by MGBT algorithms.
# An example with zero flows
PK <- dataRetrieval::readNWISpeak("07148400", convertType=FALSE)
PK <- splitPeakCodes(PK)
plotPeaks(PK, codes=TRUE, showDubNA=TRUE,
xlab="Water year", ylab="Discharge, cfs") #
# The dataRetrieval package is not required by MGBT algorithms.
PK <- dataRetrieval::readNWISpeak("08329935", convertType=FALSE)
PK <- splitPeakCodes(PK)
plotPeaks(PK, codes=TRUE, showDubNA=TRUE,
xlab="Water year", ylab="Discharge, cfs") #