Learn R Programming

EGRET (version 2.3.0)

plotDiffContours: Plots the difference between two years from a contour plot created by plotContours

Description

These plots are normally used for plotting changes in the estimated concentration surface (whatSurface=3) but can be used to explore the changes in estimated surfaces for the log of concentration or for the standard error (in log space) which is what determines the bias correction. Although there are a lot of optional arguments to this function, most are set to a logical default. Data come from named list, which contains a Sample dataframe with the sample data, a Daily dataframe with the daily flow data, and an INFO dataframe with metadata.

Usage

plotDiffContours(eList, year0, year1, qBottom, qTop, maxDiff, whatSurface = 3,
  tcl = 0.1, qUnit = 2, span = 60, pval = 0.05, printTitle = TRUE,
  plotPercent = FALSE, vert1 = NA, vert2 = NA, horiz = NA,
  flowDuration = TRUE, yTicks = NA, tick.lwd = 2, lwd = 1,
  cex.main = 0.95, cex.axis = 1, customPar = FALSE,
  color.palette = colorRampPalette(c("blue", "white", "red")), ...)

Arguments

eList
named list with at least the Daily and INFO dataframes, and surfaces matrix
year0
numeric value for the calendar year that is the first year of the pair of years for the analysis, should be a whole number
year1
numeric value for the calendar year that is the second year of the pair of years for the analysis, should be a whole number
qBottom
numeric value for the bottom edge of the graph, expressed in the units of discharge that are being used (as specified in qUnit)
qTop
numeric value for the top edge of the graph, expressed in the units of discharge that are being used (as specified in qUnit)
maxDiff
numeric value which is the absolute value of the largest change in concentration that will be shown on the figure. Alternatively, a vector with the minimum and maximum values in the change in concentration scale.
whatSurface
numeric value, can only accept 1, 2, or 3; whatSurface=1 is yHat (log concentration), whatSurface=2 is SE (standard error of log concentration), and whatSurface=3 is ConcHat (unbiased estimate of concentration), default = 3
tcl
numeric, length of tick marks in inches, default is 0.1
qUnit
object of qUnit class. printqUnitCheatSheet, or numeric represented the short code, or character representing the descriptive name.
span
numeric, it is the half-width (in days) of the smoothing window for computing the flow duration information, default = 60
pval
numeric, the probability value for the lower flow frequency line on the graph
printTitle
logical variable if TRUE title is printed, if FALSE not printed
plotPercent
logical. If TRUE, plots percent difference, if FALSE, plots absolute differences. Defaults to FALSE.
vert1
numeric, the location in time for a black vertical line on the figure, yearStart < vert1 < yearEnd, default is NA (vertical line is not drawn)
vert2
numeric, the location in time for a black vertical line on the figure, yearStart < vert2 < yearEnd, default is NA (vertical line is not drawn)
horiz
numeric, the location in discharge for a black horizontal line on the figure, qBottom
flowDuration
logical variable if TRUE plot the flow duration lines (5 and 95 flow percentiles), if FALSE do not plot them, default = TRUE
yTicks
vector of yTick labels and marks that will be plotted in log space. If NA, will be automatically generated.
tick.lwd
line width for axis ticks, default is 2
lwd
numeric, line width of flowDuration curve, default is 1
cex.main
magnification to be used for main titles relative to the current setting of cex
cex.axis
magnification to be used for axis annotation relative to the current setting of cex
customPar
logical defaults to FALSE. If TRUE, par() should be set by user before calling this function (for example, adjusting margins with par(mar=c(5,5,5,5))). If customPar FALSE, EGRET chooses the best margins.
color.palette
a function that creates a color palette for the contour plot. Default goes from blue to white to red using the function colorRampPalette(c("blue","white","red")). A few preset options are heat.colors, topo.colors, and terrain.colors.
...
arbitrary functions sent to the generic plotting function. See ?par for details on possible parameters

Examples

Run this code
year0<-2001
year1<-2009
qBottom<-0.5
qTop<-20
maxDiff<-0.5
eList <- Choptank_eList
plotDiffContours(eList, year0,year1,qBottom,qTop,maxDiff)
       yTicksModified <- c(.1,1,10,25)
plotDiffContours(eList, year0, year1,qBottom,qTop,maxDiff,
       yTicks=yTicksModified,flowDuration=FALSE)
colors <-colorRampPalette(c("blue","white","red"))
plotDiffContours(eList, year0,year1,qBottom,qTop,maxDiff,
       color.palette=colors,flowDuration=FALSE)
colors2 <- heat.colors # Some other options: topo.colors, terrain.colors, cm.colors
plotDiffContours(eList, year0,year1,qBottom,qTop,maxDiff,
       lwd=2,color.palette=colors2,flowDuration=FALSE)
plotDiffContours(eList, year0,year1,qBottom,qTop,maxDiff,cex.lab=2,flowDuration=FALSE)
par(mar=c(5,8,5,8))
plotDiffContours(eList, year0,year1,qBottom,qTop,maxDiff,
       customPar=TRUE,flowDuration=FALSE)

Run the code above in your browser using DataLab