Learn R Programming

hydroGOF (version 0.2-2)

plotbands: Plot a ts with observed values and two confidence bounds

Description

It plots a ts with observed values and two confidence bounds. Optionally can also add a simulated time series, in order to be compared with 'x'.

Usage

plotbands(x, lband, uband, sim, 
          dates, date.fmt="%Y-%m-%d",
          gof.leg= TRUE, gof.digits=2, 
          legend=c("Obs", "Sim", "95PPU"), leg.cex=1,
          bands.col="lightblue", border= NA,
          tick.tstep= "months", lab.tstep= "years", lab.fmt,
          cal.ini=NA, val.ini=NA, 
          main="Confidence Bounds for 'x'", 
          xlab="Time", ylab="Q, [m3/s]", ylim,
          col=c("black", "blue"), type= c("lines", "lines"),
          cex= c(0.5, 0.5), cex.axis=1.2, cex.lab=1.2,          
          lwd=c(0.6, 1), lty=c(3, 4), pch=c(1,9), ...)

Arguments

x
ts or zoo object with the observed values.
lband
ts or zoo object with the values of the lower band.
uband
ts or zoo object with the values of the upper band.
sim
OPTIONAL. ts or zoo object with the simulated values.
dates
OPTIONAL. Date, factor, or character object indicating the dates that will be assigned to x, lband, uband, and sim (when provided). If dates is a factor or character vector, its values are
date.fmt
OPTIONAL. Character indicating the format in which the dates entered are stored in cal.ini and val.ini. See format in as.Date. Default value is %Y-%m-%d
gof.leg
logical indicating if the p-factor and r-factor have to be computed and plotted as legends on the graph.
gof.digits
OPTIONAL, numeric. Only used when gof.leg=TRUE. Decimal places used for rounding the goodness-of-fit indexes
legend
OPTIONAL. logical or character vector of length 3 with the strings that will be used for the legend of the plot. -) When legend is a character vector, the first element is used for labelling the observed series, the second for labelling the
leg.cex
OPTIONAL. numeric. Used for the GoF legend. Character expansion factor *relative* to current 'par("cex")'. Used for text, and provides the default for 'pt.cex' and 'title.cex'. Default value is 1.
bands.col
See polygon. Color to be used for filling the area between the lower and upper uncertainty bound.
border
See polygon. The color to draw the border. The default, 'NULL', means to use 'par("fg")'. Use 'border = NA' to omit borders.
tick.tstep
character indicating the time step that have to be used for putting the ticks on the time axis. Possible values are: days, months, years.
lab.tstep
character indicating the time step that have to be used for putting the labels on the time axis. Possible values are: days, months, years.
lab.fmt
Character indicating with the format to be used for the label of the axis. See format in as.Date. If not specified, it will try "%Y-%m-%d" when lab.tstep=="days",
cal.ini
OPTIONAL. Character with the date in which the calibration period started. ONLY used for drawing a vertical red line at this date.
val.ini
OPTIONAL. Character with the date in which the validation period started. ONLY used for drawing a vertical red line at this date.
main
an overall title for the plot: see 'title'
xlab
a title for the x axis: see 'title'
ylab
a title for the y axis: see 'title'
ylim
the y limits of the plot. See plot.default.
col
colors to be used for plotting the x and sim ts.
type
character. Indicates if the observed and simulated series have to be plotted as lines or points. Possible values are: -) lines : the observed/simulated series are plotted as lines -) points: the observed/simulated series are plott
cex
See code {plot.default}. A numerical vector giving the amount by which plotting characters and symbols should be scaled relative to the default. This works as a multiple of 'par("cex")'. 'NULL' and 'NA' a
cex.axis
magnification of axis annotation relative to 'cex'.
cex.lab
Magnification to be used for x and y labels relative to the current setting of 'cex'. See '?par'.
lwd
See plot.default. The line width, see 'par'.
lty
See plot.default. The line type, see 'par'.
pch
numeric, with the type of symbol for x and y. (e.g.: 1: white circle; 9: white rhombus with a cross inside)
...
further arguments passed to the code{points} function for plotting x, or from other methods

See Also

pfactor, rfactor

Examples

Run this code
# Loading daily streamflows of the Ega River (Spain), from 1961 to 1970
require(zoo)
data(EgaEnEstellaQts)
obs <- EgaEnEstellaQts

# Selecting only the daily values belonging to the year 1961
obs <- window(obs, end=as.Date("1961-12-31"))

# Generating the lower and upper uncertainty bounds
lband <- obs - 5
uband <- obs + 5

plotbands(obs, lband, uband)

# Randomly generating a simulated time series
sim <- obs + rnorm(length(obs), mean=3)

plotbands(obs, lband, uband, sim)

Run the code above in your browser using DataLab