Commit 4914dfab authored by unknown's avatar unknown
Browse files

v0.1.1.6 plot.ObsGR function has new xlab, ylab and main default values

parent f538aeea
Package: airGRteaching
Type: Package
Title: Tools to Simplify the Use of the airGR Hydrological Package for Education (including a Shiny Application)
Version: 0.1.1.5
Version: 0.1.1.6
Date: 2017-02-16
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")))
Depends: airGR (>= 1.0.5.4)
......
plot.ObsGR <- function(x, type = "l", col.Precip = "royalblue", col.Q = "black", col.na = "grey",
xlab = "Time", ylab = c("Precipitation [mm]", "Flow [mm]"), main = "", plot.na = TRUE, ...) {
xlab = NULL, ylab = NULL, main = NULL, plot.na = TRUE, ...) {
if (! any(class(x) %in% "ObsGR")) {
stop("Non convenient data for x argument. Must be of class \"ObsGR\"")
}
if (is.null(xlab)) {
xlab <- "Time"
}
if (is.null(ylab)) {
yunit <- .TypeModelGR(x)$TimeUnit
ylab <- paste0(c("precip. [mm/", "flow [mm/"), yunit, "]")
} else {
if (length(ylab) < 2) {
ylab <- c(ylab, "")
}
}
data <- data.frame(DatesR = x$InputsModel$DatesR,
Precip = x$InputsModel$Precip,
Qobs = x$Qobs)
......@@ -13,11 +25,11 @@ plot.ObsGR <- function(x, type = "l", col.Precip = "royalblue", col.Q = "black",
par(mar = c(0.1, 4, 4, 2), xaxt = "n")
plot(Precip ~ DatesR, data = data, type = "h", col = col.Precip,
xlab = "", ylab = ylab[1L], main = "", ylim = rev(range(data$Precip)))
xlab = "", ylab = ylab[1L], main = main, ylim = rev(range(data$Precip)))
par(mar = c(5, 4, 0.1, 2), xaxt = "s")
plot(Qobs ~ DatesR, data = data, type = type, col = col.Q,
xlab = xlab, ylab = ylab[2L], main = main)
xlab = xlab, ylab = ylab[2L], main = "")
if (plot.na) {
axis(side = 1, at = as.POSIXct(data$DatesR[is.na(data$Qobs)]),
......
......@@ -6,7 +6,7 @@
\usage{
\method{plot}{ObsGR}(x, type = "l", col.Precip = "royalblue", col.Q = "black", col.na = "grey",
xlab = "Time", ylab = c("Precipitation [mm]", "Flow [mm]"), main = "",
xlab = NULL, ylab = NULL, main = NULL,
plot.na = TRUE, ...)
}
......@@ -22,11 +22,11 @@
\item{col.na}{[character] color code or name for missign values, see \code{\link{par}}}
\item{xlab}{[character] a title for the x axis: see \code{\link{title}}}
\item{xlab}{(optional) [character] a label for the x axis: see \code{\link{title}}}
\item{ylab}{[character] a title for the y axis: see \code{\link{title}}}
\item{ylab}{(optional) [character] a label for the y axis (flow and rainfall): see \code{\link{title}}}
\item{main}{[character] an overall title for the plot: see \code{\link{title}}}
\item{main}{(optional) [character] a main title for the plo: see \code{\link{title}}}
\item{plot.na}{[boolean] boolean indicating if tna missing values are plotted on the x axis}
......
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