plot2 | R Documentation |
Plotting of 2 time series, in two different vertical windows or overlapped in the same window.
It requires the hydroTSM package.
plot2(x, y, plot.type = "multiple",
tick.tstep = "auto", lab.tstep = "auto", lab.fmt=NULL,
main, xlab = "Time", ylab,
cal.ini=NA, val.ini=NA, date.fmt="%Y-%m-%d",
gof.leg = FALSE, gof.digits=2,
gofs=c("ME", "MAE", "RMSE", "NRMSE", "PBIAS", "RSR", "rSD", "NSE", "mNSE",
"rNSE", "d", "md", "rd", "r", "R2", "bR2", "KGE", "VE"),
legend, leg.cex = 1,
col = c("black", "blue"),
cex = c(0.5, 0.5), cex.axis=1.2, cex.lab=1.2,
lwd= c(1,1), lty=c(1,3), pch = c(1, 9),
pt.style = "ts", add = FALSE,
...)
x |
time series that will be plotted. class(x) must be ts or zoo. If |
y |
time series that will be plotted. class(x) must be ts or zoo. If |
plot.type |
character, indicating if the 2 ts have to be plotted in the same window or in two different vertical ones. Valid values are: |
tick.tstep |
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. |
lab.tstep |
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. |
lab.fmt |
Character indicating the format to be used for the label of the axis. See |
main |
an overall title for the plot: see |
xlab |
label for the 'x' axis |
ylab |
label for the 'y' axis |
cal.ini |
OPTIONAL. Character, indicating the date in which the calibration period started. |
val.ini |
OPTIONAL. Character with the date in which the validation period started. |
date.fmt |
OPTIONAL. Character indicating the format in which the dates entered are stored in |
gof.leg |
logical, indicating if several numerical goodness-of-fit values have to be computed between |
gof.digits |
OPTIONAL, only used when |
gofs |
character, with one or more strings indicating the goodness-of-fit measures to be shown in the legend of the plot when |
legend |
vector of length 2 to appear in the legend. |
leg.cex |
numeric, indicating the character expansion factor *relative* to current 'par("cex")'. Used for text, and provides the default for 'pt.cex' and 'title.cex'. Default value = 1 |
col |
character, with the colors of |
cex |
numeric, with the values controlling the size of text and symbols of |
cex.axis |
numeric, with the magnification of axis annotation relative to 'cex'. See |
cex.lab |
numeric, with the magnification to be used for x and y labels relative to the current setting of 'cex'. See |
lwd |
vector with the line width of |
lty |
vector with the line type of |
pch |
vector with the type of symbol for |
pt.style |
Character, indicating if the 2 ts have to be plotted as lines or bars. Valid values are: |
add |
logical indicating if other plots will be added in further calls to this function. |
... |
further arguments passed to |
It requires the package hydroTSM.
Mauricio Zambrano Bigiarini <mzb.devel@gmail.com>
ggof
, plot_pq
sim <- 2:11
obs <- 1:10
## Not run:
plot2(sim, obs)
## End(Not run)
##################
# Loading daily streamflows of the Ega River (Spain), from 1961 to 1970
data(EgaEnEstellaQts)
obs <- EgaEnEstellaQts
# Generating a simulated daily time series, initially equal to the observed series
sim <- obs
# Randomly changing the first 2000 elements of 'sim', by using a normal distribution
# with mean 10 and standard deviation equal to 1 (default of 'rnorm').
sim[1:2000] <- obs[1:2000] + rnorm(2000, mean=10)
# Plotting 'sim' and 'obs' in 2 separate panels
plot2(x=obs, y=sim)
# Plotting 'sim' and 'obs' in the same window
plot2(x=obs, y=sim, plot.type="single")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.