Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
HYCAR-Hydro
airGRteaching
Commits
c5fbbe8c
Commit
c5fbbe8c
authored
Feb 16, 2017
by
unknown
Browse files
v0.1.1.7 plot.CalGR function has new xlab, ylab and main default values
parent
4914dfab
Changes
3
Hide whitespace changes
Inline
Side-by-side
DESCRIPTION
View file @
c5fbbe8c
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.
6
Version: 0.1.1.
7
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)
...
...
R/plot.CalGR.R
View file @
c5fbbe8c
plot.CalGR
<-
function
(
x
,
which
=
c
(
"perf"
,
"hist"
,
"time"
),
...
)
{
plot.CalGR
<-
function
(
x
,
xlab
=
NULL
,
ylab
=
NULL
,
main
=
NULL
,
which
=
c
(
"perf"
,
"hist"
,
"time"
),
...
)
{
if
(
!
any
(
class
(
x
)
%in%
"CalGR"
))
{
stop
(
"Non convenient data for x argument. Must be of class \"CalGR\""
)
...
...
@@ -53,6 +53,17 @@ plot.CalGR <- function(x, which = c("perf", "hist", "time"), ...) {
}
if
(
any
(
which
[
1L
]
%in%
c
(
"time"
)))
{
if
(
is.null
(
xlab
))
{
xlab
<-
"Time"
}
if
(
is.null
(
ylab
))
{
yunit
<-
.TypeModelGR
(
x
)
$
TimeUnit
ylab
<-
paste0
(
c
(
"flow [mm/"
,
"precip. [mm/"
),
yunit
,
"]"
)
}
else
{
if
(
length
(
ylab
)
<
2
)
{
ylab
<-
c
(
ylab
,
""
)
}
}
data
<-
data.frame
(
DatesR
=
x
$
OutputsModel
$
DatesR
,
Precip
=
x
$
OutputsModel
$
Precip
,
Qobs
=
x
$
Qobs
,
...
...
@@ -60,11 +71,11 @@ plot.CalGR <- function(x, which = c("perf", "hist", "time"), ...) {
par
(
mar
=
c
(
0.1
,
4
,
4
,
1
),
xaxt
=
"n"
)
plot
(
Precip
~
DatesR
,
data
=
data
,
type
=
"h"
,
col
=
"royalblue"
,
xlab
=
""
,
ylab
=
"Precip."
,
main
=
""
,
ylim
=
rev
(
range
(
data
$
Precip
)))
xlab
=
""
,
ylab
=
ylab
[
2L
]
,
main
=
main
,
ylim
=
rev
(
range
(
data
$
Precip
)))
par
(
mar
=
c
(
5
,
4
,
0.1
,
1
),
xaxt
=
"s"
)
matplot
(
data
$
DatesR
,
data
[,
c
(
"Qobs"
,
"Qsim"
)],
type
=
"l"
,
col
=
c
(
"black"
,
"orangered"
),
lty
=
1
,
xlab
=
"Time"
,
ylab
=
"Flow"
,
main
=
""
,
xaxt
=
"n"
)
xlab
=
xlab
,
ylab
=
ylab
[
1L
]
,
main
=
""
,
xaxt
=
"n"
)
axis.POSIXct
(
side
=
1
,
x
=
data
$
DatesR
)
# if (plot.na) {
...
...
man/plot.CalGR.Rd
View file @
c5fbbe8c
...
...
@@ -5,14 +5,20 @@
\usage{
\method{plot}{CalGR}(x, which = c("perf", "hist", "time"), ...)
\method{plot}{CalGR}(x,
xlab = NULL, ylab = NULL, main = NULL,
which = c("perf", "hist", "time"), ...)
}
\arguments{
\item{x}{[object of class \emph{CalGR}] see \code{\link{CalGR}} for details}
\item{which}{[character] XXXX \code{"perf"}, \code{"hist"}, \code{"time"}},
\item{xlab}{(optional) [character] a label for the x axis: see \code{\link{title}}}
\item{ylab}{(optional) [character] a label for the y axis (flow and rainfall): see \code{\link{title}}}
\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{...}{other parameters to be passed through to plotting functions}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment