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'.
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= "auto", lab.tstep= "auto", lab.fmt=NULL,
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), ...)
zoo or xts object with the observed values.
zoo or xts object with the values of the lower band.
zoo or xts object with the values of the upper band.
OPTIONAL. zoo or xts object with the simulated values.
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 converted to dates using the date format specified by date.fmt
.
When x
, lband
, uband
, and sim
are already of zoo class, the values provided by dates
over-write the original dates of the objects.
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
ONLY required when cal.ini
, val.ini
or dates
is provided.
logical indicating if the p-factor and r-factor have to be computed and plotted as legends on the graph.
OPTIONAL, numeric. Only used when gof.leg=TRUE
. Decimal places used for rounding the goodness-of-fit indexes
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 simulated series and the third one for the predictive uncertainty bounds. Default value is c("obs", "sim", "95PPU")
-) When legend=FALSE
, the legend is not drawn.
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.
See polygon
. Color to be used for filling the area between the lower and upper uncertainty bound.
See polygon
. The color to draw the border. The default, 'NULL', means to use 'par("fg")'. Use 'border = NA' to omit borders.
character, indicating the time step that have to be used for putting the ticks on the time axis. Valid values are: auto, years, months,weeks, days, hours, minutes, seconds.
character, indicating the time step that have to be used for putting the labels on the time axis. Valid values are: auto, years, months,weeks, days, hours, minutes, seconds.
Character indicating the format to be used for the label of the axis. See lab.fmt
in drawTimeAxis
.
OPTIONAL. Character with the date in which the calibration period started.
ONLY used for drawing a vertical red line at this date.
OPTIONAL. Character with the date in which the validation period started.
ONLY used for drawing a vertical red line at this date.
an overall title for the plot: see 'title'
a title for the x axis: see 'title'
a title for the y axis: see 'title'
the y limits of the plot. See plot.default
.
colors to be used for plotting the x
and sim
ts.
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 plotted as points
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' are equivalent to '1.0'. Note that this does not affect annotation.
magnification of axis annotation relative to 'cex'.
Magnification to be used for x and y labels relative to the current setting of 'cex'. See '?par'.
See plot.default
. The line width, see 'par'.
See plot.default
. The line type, see 'par'.
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 points
function for plotting x
, or from other methods
Mauricio Zambrano Bigiarini <mzb.devel@gmail.com>
pfactor
, rfactor
# Loading daily streamflows of the Ega River (Spain), from 1961 to 1970
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
if (FALSE) {
plotbands(obs, lband, uband)
}
# Randomly generating a simulated time series
sim <- obs + rnorm(length(obs), mean=3)
if (FALSE) {
plotbands(obs, lband, uband, sim)
}
Run the code above in your browser using DataLab