From 2d033329ae41a1aa1d5ce4ff015bf108f079decc Mon Sep 17 00:00:00 2001
From: unknown <olivier.delaigue@ANPI1430.antony.irstea.priv>
Date: Thu, 23 Feb 2017 18:00:04 +0100
Subject: [PATCH] v1.0.5.22 remove the using of dev.new() in the
 plot.OutputsModel() when RStudio is not used because it causes some disorders
 when airGRteachin uses it in shiny (not plot in the interface when a script
 is called from Rscript.exe or R.exe)

---
 DESCRIPTION           |  4 ++--
 R/plot.OutputsModel.R | 26 +++++++++++++-------------
 2 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/DESCRIPTION b/DESCRIPTION
index 6d7bc795..5e006f13 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -1,8 +1,8 @@
 Package: airGR
 Type: Package
 Title: Suite of GR Hydrological Models for Precipitation-Runoff Modelling
-Version: 1.0.5.21
-Date: 2017-02-16
+Version: 1.0.5.22
+Date: 2017-02-23
 Authors@R: c(
   person("Laurent", "Coron", role = c("aut", "trl")),
   person("Charles", "Perrin", role = c("aut", "ths")),
diff --git a/R/plot.OutputsModel.R b/R/plot.OutputsModel.R
index 4bb14207..5a159518 100644
--- a/R/plot.OutputsModel.R
+++ b/R/plot.OutputsModel.R
@@ -104,19 +104,19 @@ plot.OutputsModel <- function(x, Qobs = NULL, IndPeriod_Plot = NULL, BasinArea =
       matlayout <- rbind(matlayout, iPlot+1); iPlot <- iPlot+1; }
     iPlotMax <- iPlot;
 
-    isRStudio <- Sys.getenv("RSTUDIO") == "1";
-    if(!isRStudio){ 
-      if(Sum1 == 1 & Sum2 == 0){ width = 10; height = 05; }
-      if(Sum1 == 1 & Sum2 != 0){ width = 10; height = 07; }
-      if(Sum1 == 2 & Sum2 == 0){ width = 10; height = 05; }
-      if(Sum1 == 2 & Sum2 != 0){ width = 10; height = 07; }
-      if(Sum1 == 3 & Sum2 == 0){ width = 10; height = 07; }
-      if(Sum1 == 3 & Sum2 != 0){ width = 10; height = 10; }
-      if(Sum1 == 0 & Sum2 == 1){ width = 05; height = 05; }
-      if(Sum1 == 0 & Sum2 == 2){ width = 10; height = 04; }
-      if(Sum1 == 0 & Sum2 == 3){ width = 10; height = 03; }
-      dev.new(width = width, height = height)
-    }
+    # isRStudio <- Sys.getenv("RSTUDIO") == "1";
+    # if(!isRStudio){ 
+    #   if(Sum1 == 1 & Sum2 == 0){ width = 10; height = 05; }
+    #   if(Sum1 == 1 & Sum2 != 0){ width = 10; height = 07; }
+    #   if(Sum1 == 2 & Sum2 == 0){ width = 10; height = 05; }
+    #   if(Sum1 == 2 & Sum2 != 0){ width = 10; height = 07; }
+    #   if(Sum1 == 3 & Sum2 == 0){ width = 10; height = 07; }
+    #   if(Sum1 == 3 & Sum2 != 0){ width = 10; height = 10; }
+    #   if(Sum1 == 0 & Sum2 == 1){ width = 05; height = 05; }
+    #   if(Sum1 == 0 & Sum2 == 2){ width = 10; height = 04; }
+    #   if(Sum1 == 0 & Sum2 == 3){ width = 10; height = 03; }
+    #   dev.new(width = width, height = height)
+    # }
     layout(matlayout);
 
     Xaxis <- 1:length(IndPeriod_Plot);
-- 
GitLab