From 6d548c0089346c3e67d4b109edb822bd7f5ce502 Mon Sep 17 00:00:00 2001
From: Delaigue Olivier <olivier.delaigue@irstea.priv>
Date: Thu, 6 Jun 2019 11:26:06 +0200
Subject: [PATCH] v1.2.16.11 UPDATE: the Error plot of plot.OutputsModel fun
 now displays Qsim - Qobs instaed of Qsim/Qobs

---
 DESCRIPTION           |  2 +-
 NEWS.rmd              |  3 ++-
 R/plot.OutputsModel.R | 13 ++++++++-----
 3 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/DESCRIPTION b/DESCRIPTION
index 5916662a..9a32e72b 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -1,7 +1,7 @@
 Package: airGR
 Type: Package
 Title: Suite of GR Hydrological Models for Precipitation-Runoff Modelling
-Version: 1.2.16.10
+Version: 1.2.16.11
 Date: 2019-06-06
 Authors@R: c(
   person("Laurent", "Coron", role = c("aut", "trl"), comment = c(ORCID = "0000-0002-1503-6204")),
diff --git a/NEWS.rmd b/NEWS.rmd
index dfc54cc1..c0f9e0b3 100644
--- a/NEWS.rmd
+++ b/NEWS.rmd
@@ -13,7 +13,8 @@ output:
 
 
 
-6-065-23)
+
+### 1.2.16.11 Release Notes (2019-06-06)
 
 
 #### New features
diff --git a/R/plot.OutputsModel.R b/R/plot.OutputsModel.R
index 66c61b81..e87e934f 100644
--- a/R/plot.OutputsModel.R
+++ b/R/plot.OutputsModel.R
@@ -594,19 +594,22 @@ plot.OutputsModel <- function(x, Qobs = NULL, IndPeriod_Plot = NULL, BasinArea =
   if (BOOLPLOT_Error) {
     kPlot <- kPlot + 1
     mar <- c(3, 5, 1, 5)
-    plotunitError <- "[-]"
     
-    errorQ <- OutputsModel$Qsim / Qobs
+    if (log_scale) {
+      errorQ <- log(OutputsModel$Qsim) - log(Qobs)
+    } else {
+      errorQ <- OutputsModel$Qsim - Qobs
+    }
     par(new = FALSE, mar = mar)
     ylim1 <- range(errorQ[IndPeriod_Plot], na.rm = TRUE)
     
     plot(Xaxis, errorQ[IndPeriod_Plot],
          type = "l", xaxt = "n", yaxt = "n", ylim = ylim1,
          col = "grey50", lwd = lwd * lwdk,
-         xlab = "", ylab = "", log = ifelse(log_scale, "y", ""),
-         panel.first = abline(h = 1, col = "grey", lty = 2), ...)
+         xlab = "", ylab = "",
+         panel.first = abline(h = 0, col = "grey"), ...)
     axis(side = 2, at = pretty(ylim1), labels = pretty(ylim1), cex.axis = cex.axis, ...)
-    mtext(side = 2, paste("flow err.", plotunitError), cex = cex.lab, line = line)
+    mtext(side = 2, paste("flow error", plotunit), cex = cex.lab, line = line)
     if (BOOL_Dates) {
       axis(side = 1, at = Seq1, labels = FALSE, cex.axis = cex.axis, ...)
       axis(side = 1, at = Seq2, labels = Labels2, lwd.ticks = 1.5, cex.axis = cex.axis, ...)
-- 
GitLab