diff --git a/DESCRIPTION b/DESCRIPTION index ca2b3a6ef8c78fb8863c09b6ee594975badb9d6d..c8d76dc180a613dcae60d954917b6df9220408c1 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.9.13 -Date: 2017-07-11 +Version: 1.0.9.14 +Date: 2017-07-12 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 334614e8f800810637305188c55aff47a0f8597f..39cbdd70274493d6124cc865032dcc7b6b731066 100644 --- a/R/plot.OutputsModel.R +++ b/R/plot.OutputsModel.R @@ -162,9 +162,15 @@ plot.OutputsModel <- function(x, Qobs = NULL, IndPeriod_Plot = NULL, BasinArea = kPlot <- 0 - ## vector of Q values for the y-axis when it is expressed in - seqDATA1 <- log(c(0.01, 0.02, 0.05, 0.1, 0.2, 0.5, 1, 2, 5, 10, 20, 50, 100, 200, 500, 1000, 2000, 5000, 10000)) + ## vector of Q values for the y-axis when it is expressed in + Factor <- ifelse(!is.null(BasinArea), Factor_UNIT_M3S, 1) + seqDATA0 <- c(0.01, 0.02, 0.05, 0.1, 0.2, 0.5, 1, 2, 5, 10, 20, 50, 100, 200, 500, 1000, 2000, 5000, 10000) + seqDATA1 <- log(seqDATA0) seqDATA2 <- exp(seqDATA1) + if (!is.null(BasinArea)) { + seqDATA1ba <- log(seqDATA0 * Factor_UNIT_M3S) + seqDATA2ba <- round(exp(seqDATA1ba), digits = 2) + } ##Precip if (BOOLPLOT_Precip) { @@ -268,7 +274,7 @@ plot.OutputsModel <- function(x, Qobs = NULL, IndPeriod_Plot = NULL, BasinArea = DATA2 <- log(DATA2) DATA3 <- OutputsModel$Qsim - DATA2[!SelectQsimNotZero] <- mean(OutputsModel$Qsim, na.rm = TRUE) / 10000 + DATA3[!SelectQsimNotZero] <- mean(OutputsModel$Qsim, na.rm = TRUE) / 10000 DATA3 <- log(DATA3) ylim1 <- range(DATA3[IndPeriod_Plot], na.rm = TRUE); @@ -282,7 +288,7 @@ plot.OutputsModel <- function(x, Qobs = NULL, IndPeriod_Plot = NULL, BasinArea = par(las = 0); mtext(side = 2, paste0("flow ", plotunit), line = line, cex = cex.lab); par(las = 0); if (!is.null(BasinArea)) { Factor <- Factor_UNIT_M3S; - axis(side = 4, at = pretty(ylim1*Factor)/Factor, labels = pretty(ylim1*Factor), cex.axis = cex.axis, ...); + axis(side = 4, at = seqDATA1ba, labels = seqDATA2ba, cex.axis = cex.axis, ...) par(las = 0); mtext(side = 4, paste0("flow ", "m3/s"), line = line, cex = cex.lab); par(las = 0); } if (BOOL_Dates) { axis(side = 1, at = Seq1, labels = FALSE, cex.axis = cex.axis, ...); @@ -463,7 +469,7 @@ plot.OutputsModel <- function(x, Qobs = NULL, IndPeriod_Plot = NULL, BasinArea = } if (!is.null(BasinArea)) { Factor <- Factor_UNIT_M3S; - axis(side = 4, at = seqDATA1, labels = round(seqDATA2*Factor), cex.axis = cex.axis, ...) + axis(side = 4, at = seqDATA1, labels = round(seqDATA2*Factor, dig = 2), cex.axis = cex.axis, ...) par(las = 0); mtext(side = 4, paste0("flow ", "m3/s"), line = line, cex = cex.lab); par(las = 0) } legend("topleft", txtleg, col = colleg, lty = 1, lwd = lwd, bty = "o", bg = bg, box.col = bg, cex = cex.leg) @@ -495,7 +501,7 @@ plot.OutputsModel <- function(x, Qobs = NULL, IndPeriod_Plot = NULL, BasinArea = par(las = 0); mtext(side = 2, paste0("simulated flow ", plotunit), line = line, cex = cex.lab); par(las = 0); if (!is.null(BasinArea)) { Factor <- Factor_UNIT_M3S; - axis(side = 4, at = seqDATA1, labels = round(seqDATA2*Factor), cex.axis = cex.axis, ...); + axis(side = 4, at = seqDATA1, labels = round(seqDATA2*Factor, dig = 2), cex.axis = cex.axis, ...); par(las = 0); mtext(side = 4, paste0("flow ", "m3/s"), line = line, cex = cex.lab); par(las = 0); } legend("bottomright", "log scale", lty = 1, col = NA, bty = "o", bg = bg, box.col = bg, cex = cex.leg) } else {