Commit 35457828 authored by unknown's avatar unknown
Browse files

v0.1.2.36 argument values possibilities renamed in plot.CalGR

parent e49ea444
Package: airGRteaching
Type: Package
Title: Tools to Simplify the Use of the airGR Hydrological Package for Education (Including a Shiny Application)
Version: 0.1.2.35
Version: 0.1.2.36
Date: 2017-04-10
Authors@R: c(person("Olivier", "Delaigue", role = c("aut", "cre"), email = "airGR@irstea.fr"), person("Laurent", "Coron", role = c("aut")), person("Pierre", "Brigode", role = c("aut")), person("Guillaume", "Thirel", role = c("ctb")))
Depends: airGR (>= 1.0.5.22)
......
plot.CalGR <- function(x, xlab = NULL, ylab = NULL, main = NULL, which = c("perf", "hist", "time"), ...) {
plot.CalGR <- function(x, xlab = NULL, ylab = NULL, main = NULL, which = c("perf", "iter", "ts"), ...) {
if (! any(class(x) %in% "CalGR")) {
stop("Non convenient data for x argument. Must be of class \"CalGR\"")
}
if (! any(which %in% c("perf", "hist", "time"))) {
stop("Non convenient data for which argument. Must be of class \"perf\", \"hist\" or \"time\"")
if (! any(which %in% c("perf", "iter", "ts"))) {
stop("Non convenient data for which argument. Must be of class \"perf\", \"iter\" or \"ts\"")
}
nbParamX <- .TypeModelGR(x)$NbParam #as.numeric(gsub("\\D", "", x$TypeModel))
......@@ -16,7 +16,7 @@ plot.CalGR <- function(x, xlab = NULL, ylab = NULL, main = NULL, which = c("per
plot(x$OutputsModel, Qobs = x$Qobs, ...)
}
if (any(which[1L] %in% c("hist"))) {
if (any(which[1L] %in% c("iter"))) {
layout.list <- list(matrix(c(1:2), ncol = 2),
matrix(c(1:3, 3), ncol = 2),
matrix(NA),
......@@ -34,11 +34,11 @@ plot.CalGR <- function(x, xlab = NULL, ylab = NULL, main = NULL, which = c("per
# layout.mat <- rbind(layout.mat, max(layout.mat)+1, max(layout.mat)+2)
# layout(mat = layout.mat, widths = layout.w, heights = layout.h)
# }
if (which[1L] %in% c("time")) {
if (which[1L] %in% c("ts")) {
layout(mat = matrix(1:2), widths = c(1, 2), heights = c(1, 2))
}
if (any(which[1L] %in% c("hist"))) {
if (any(which[1L] %in% c("iter"))) {
ParamLab <- data.frame(Name = c(sprintf("X%i", 1:6), sprintf("C%i", 1:2)),
Label = c("prod. store capacity [mm]",
......@@ -67,7 +67,7 @@ plot.CalGR <- function(x, xlab = NULL, ylab = NULL, main = NULL, which = c("per
main = sprintf("Efficiency criteria (%s)\nduring the steepest-descent step", gsub(".*_", "", x$CalCrit)))
}
if (any(which[1L] %in% c("time"))) {
if (any(which[1L] %in% c("ts"))) {
if (is.null(xlab)) {
xlab <- "Time"
}
......
This diff is collapsed.
......@@ -135,26 +135,26 @@ plot(OBS, main = "Observation")
By default (with the argument `which = "perf"`), the call of the `plot()` function with a `CalGR` object draws the classical <strong><font color="#009EE0">airGR</font></strong> plot diagnostics (observed and simulated time series together with diagnostic plot)
![](tab_fun_files/figure-html/unnamed-chunk-7-1.png)<!-- -->
```r
plot(CAL, which = "perf")
```
![](tab_fun_files/figure-html/unnamed-chunk-8-1.png)<!-- -->
With `CalGR` object, if the argument `which` is set to `"hist"`, the `plot()` function draws the evolution of the parameters and values of the objective function during the second step of the calibration (steepest descent local search algorithm):
With `CalGR` object, if the argument `which` is set to `"iter"`, the `plot()` function draws the evolution of the parameters and values of the objective function during the second step of the calibration (steepest descent local search algorithm):
```r
plot(CAL, which = "hist")
plot(CAL, which = "iter")
```
![](tab_fun_files/figure-html/unnamed-chunk-9-1.png)<!-- -->
With `CalGR` object, if the argument `which` is set to `"time"`, the `plot()` function simply draws the time series of the observed precipitation, and the observed and simulated flows:
With `CalGR` object, if the argument `which` is set to `"ts"`, the `plot()` function simply draws the time series of the observed precipitation, and the observed and simulated flows:
```r
plot(CAL, which = "time")
plot(CAL, which = "ts")
```
![](tab_fun_files/figure-html/unnamed-chunk-10-1.png)<!-- -->
......
......@@ -125,24 +125,24 @@ plot(OBS, main = "Observation")
By default (with the argument `which = "perf"`), the call of the `plot()` function with a `CalGR` object draws the classical `r airGR` plot diagnostics (observed and simulated time series together with diagnostic plot)
```{r, echo=FALSE, warning=FALSE}
plot(CAL, which = "perf", cex.lab = 0.7, cex.axis = 0.7)
```
```{r, echo=TRUE, eval=FALSE}
plot(CAL, which = "perf")
```
```{r, echo=FALSE, warning=FALSE}
plot(CAL, which = "perf", cex.lab = 0.7, cex.axis = 0.7)
```
With `CalGR` object, if the argument `which` is set to `"hist"`, the `plot()` function draws the evolution of the parameters and values of the objective function during the second step of the calibration (steepest descent local search algorithm):
With `CalGR` object, if the argument `which` is set to `"iter"`, the `plot()` function draws the evolution of the parameters and values of the objective function during the second step of the calibration (steepest descent local search algorithm):
```{r, fig.width=7, fig.height=3.25, dev.args=list(pointsize=10)}
plot(CAL, which = "hist")
plot(CAL, which = "iter")
```
With `CalGR` object, if the argument `which` is set to `"time"`, the `plot()` function simply draws the time series of the observed precipitation, and the observed and simulated flows:
With `CalGR` object, if the argument `which` is set to `"ts"`, the `plot()` function simply draws the time series of the observed precipitation, and the observed and simulated flows:
```{r, echo=-1}
par(cex.lab = 0.7, cex.axis = 0.7)
plot(CAL, which = "time")
plot(CAL, which = "ts")
```
The call of the `plot()` function with a `SimGR` object draws the classical `r airGR` plot diagnostics.
......
......@@ -5,7 +5,7 @@
\usage{
\method{plot}{CalGR}(x, xlab = NULL, ylab = NULL, main = NULL, which = c("perf", "hist", "time"), ...)
\method{plot}{CalGR}(x, xlab = NULL, ylab = NULL, main = NULL, which = c("perf", "iter", "ts"), ...)
}
......@@ -18,7 +18,7 @@
\item{main}{(optional) [character] a main title for the plo: see \code{\link{title}}}
\item{which}{[character] XXXX \code{"perf"}, \code{"hist"}, \code{"time"}}
\item{which}{[character] to choose the plot type (\code{"perf"} (default): plot diagnostics; \code{"iter"}: parameter values and the calibration criterion during the progression steps of calibration; \code{"ts"}: time series of observed precipitation and observed and simulated flows)}
\item{...}{other parameters to be passed through to plotting functions}
}
......@@ -49,7 +49,7 @@ OBS <- ObsGR(ObsBV = BasinObs2, TypeModel = "GR5J", CemaNeige = TRUE)
CAL <- CalGR(ObsGR = OBS, CalCrit = c("NSE", "KGE", "KGE2", "RMSE"),
WupPer = NULL, CalPer = c("1990-01-01", "1993-12-31"))
plot(CAL, which = "perf")
plot(CAL, which = "time")
plot(CAL, which = "hist")
plot(CAL, which = "ts")
plot(CAL, which = "iter")
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment