hydroplot | R Documentation |
hydroplot
: When x
is a zoo object it plots (a maximum of) 9 graphs (lines plot, boxplots and/or histograms) of the daily, monthly, annual and/or seasonal time series.
sname2plot
: When x
is a data frame whose columns contain the time series of several gauging stations, it takes the name of one gauging station and plots the graphs described above.
hydroplot(x, ...)
sname2plot(x, ...)
## Default S3 method:
hydroplot(x, FUN, na.rm=TRUE, ptype="ts+boxplot+hist", pfreq="dma",
var.type, var.unit="units", main=NULL, xlab="Time", ylab,
win.len1=0, win.len2=0, tick.tstep="auto", lab.tstep="auto",
lab.fmt=NULL, cex=0.3, cex.main=1.3, cex.lab=1.3, cex.axis=1.3,
col=c("blue", "lightblue", "lightblue"),
from=NULL, to=NULL, dates=1, date.fmt= "%Y-%m-%d",
stype="default", season.names=c("Winter", "Spring", "Summer", "Autumn"),
h=NULL, ...)
## S3 method for class 'zoo'
hydroplot(x, FUN, na.rm=TRUE, ptype="ts+boxplot+hist", pfreq="dma",
var.type, var.unit="units", main=NULL, xlab="Time", ylab,
win.len1=0, win.len2=0, tick.tstep="auto", lab.tstep="auto",
lab.fmt=NULL, cex=0.3, cex.main=1.3, cex.lab=1.3, cex.axis=1.3,
col=c("blue", "lightblue", "lightblue"),
from=NULL, to=NULL, dates=1, date.fmt= "%Y-%m-%d",
stype="default", season.names=c("Winter", "Spring", "Summer", "Autumn"),
h=NULL, ...)
## S3 method for class 'data.frame'
hydroplot(x, FUN, na.rm=TRUE, ptype="ts+boxplot+hist", pfreq="dma",
var.type, var.unit="units", main=NULL, xlab="Time", ylab,
win.len1=0, win.len2=0, tick.tstep="auto", lab.tstep="auto",
lab.fmt=NULL, cex=0.3, cex.main=1.3, cex.lab=1.3, cex.axis=1.3,
col=c("blue", "lightblue", "lightblue"),
from=NULL, to=NULL, dates=1, date.fmt= "%Y-%m-%d",
stype="default", season.names=c("Winter", "Spring", "Summer", "Autumn"),
h=NULL, ...)
## Default S3 method:
sname2plot(x, sname, FUN, na.rm=TRUE, ptype="ts+boxplot+hist",
pfreq="dma", var.type, var.unit="units", main=NULL,
xlab="Time", ylab=NULL, win.len1=0, win.len2=0,
tick.tstep="auto", lab.tstep="auto", lab.fmt=NULL,
cex=0.3, cex.main=1.3, cex.lab=1.3, cex.axis=1.3,
col=c("blue", "lightblue", "lightblue"),
dates=1, date.fmt = "%Y-%m-%d", from=NULL, to=NULL, stype="default",
season.names=c("Winter", "Spring", "Summer", "Autumn"),
h=NULL, ...)
## S3 method for class 'zoo'
sname2plot(x, sname, FUN, na.rm=TRUE, ptype="ts+boxplot+hist",
pfreq="dma", var.type, var.unit="units", main=NULL,
xlab="Time", ylab=NULL, win.len1=0, win.len2=0,
tick.tstep="auto", lab.tstep="auto", lab.fmt=NULL,
cex=0.3, cex.main=1.3, cex.lab=1.3, cex.axis=1.3,
col=c("blue", "lightblue", "lightblue"),
dates=1, date.fmt = "%Y-%m-%d", from=NULL, to=NULL, stype="default",
season.names=c("Winter", "Spring", "Summer", "Autumn"),
h=NULL, ...)
## S3 method for class 'data.frame'
sname2plot(x, sname, FUN, na.rm=TRUE, ptype="ts+boxplot+hist",
pfreq="dma", var.type, var.unit="units", main=NULL,
xlab="Time", ylab=NULL, win.len1=0, win.len2=0,
tick.tstep="auto", lab.tstep="auto", lab.fmt=NULL,
cex=0.3, cex.main=1.3, cex.lab=1.3, cex.axis=1.3,
col=c("blue", "lightblue", "lightblue"),
dates=1, date.fmt = "%Y-%m-%d", from=NULL, to=NULL, stype="default",
season.names=c("Winter", "Spring", "Summer", "Autumn"),
h=NULL, ...)
x |
zoo, xts or data.frame object, with columns storing the time series of one or more gauging stations. |
sname |
ONLY required when |
FUN |
ONLY required when |
na.rm |
Logical. Should missing values be removed before the computations? |
ptype |
Character indicating the type of plot that will be plotted. Valid values are: |
pfreq |
Character indicating how many plots are desired by the user. Valid values are: |
var.type |
ONLY required when |
var.unit |
Character representing the measurement unit of the variable being plotted. ONLY used for labelling the axes (e.g., "mm" for precipitation, "C" for temperature, and "m3/s" for flow.) |
main |
Character representing the main title of the plot. If the user do not provide a title, this is created automatically as: |
xlab |
A title for the x axis. See |
ylab |
A title for the y axis. See |
win.len1 |
number of days for being used in the computation of the first moving average. A value equal to zero indicates that this moving average is not going to be computed. |
win.len2 |
number of days for being used in the computation of the second moving average. A value equal to zero indicates that this moving average is not going to be computed. |
tick.tstep |
Character indicating the time step that have to be used for putting the ticks on the time axis. Valid values are: |
lab.tstep |
Character indicating the time step that have to be used for putting the labels on the time axis. Valid values are: |
lab.fmt |
Character indicating with the format to be used for the label of the axis. See |
cex |
A numerical value giving the amount by which plotting text and symbols should be magnified relative to the default. (See |
cex.main |
The magnification to be used for main titles relative to the current setting of |
cex.lab |
The magnification to be used for x and y labels relative to the current setting of |
cex.axis |
The magnification to be used for axis annotation relative to the current setting of |
col |
A character vector with 3 elements, representing the colors to be used for plotting the lines of the ts, the boxplots, and the histograms, respectively. |
dates |
ONLY required when |
date.fmt |
Character indicating the format in which the dates are stored in dates, from and to. See |
from |
OPTIONAL, used for extracting a subset of values. |
to |
OPTIONAL, used for extracting a subset of values. |
stype |
OPTIONAL, only used when |
season.names |
OPTIONAL, only used when |
h |
OPTIONAL, only used when |
... |
further arguments passed to the |
Plots of the daily/monthly/annual/seasonal values of the time series given as input.
Depending on the value of pfreq
, daily, monthly, annual and/or seasonal time series plots, boxplots and histograms are produced.
Depending on the value of ptype
, time series plots, boxplots and/or histograms are produced.
Mauricio Zambrano-Bigiarini, mzb.devel@gmail
sname2ts
#############
## Loading daily streamflows at the station Oca en Ona (Ebro River basin, Spain) ##
data(OcaEnOnaQts)
## 3 ts, 3 boxplots and 3 histograms
hydroplot(OcaEnOnaQts, FUN=mean, ylab= "Q", var.unit = "m3/s")
## only the original time series
hydroplot(OcaEnOnaQts, pfreq="o")
## only the year 1962 of the original time series
hydroplot(OcaEnOnaQts, pfreq="o", from="1962-01-01", to="1962-12-31")
## Not run:
## seasonal plots
hydroplot(OcaEnOnaQts, pfreq="seasonal", FUN=mean, stype="default")
## custom season names (let's assume to be in the Southern Hemisphere)
hydroplot(OcaEnOnaQts, pfreq="seasonal", FUN=mean,
stype="default", season.names=c("Summer","Autumn", "Winter","Spring"))
## End(Not run)
#############
## Loading the monthly time series of precipitation within the Ebro River basin.
data(EbroPPtsMonthly)
## Plotting the monthly and annual values of precipitation at station "P9001",
## stored in 'EbroPPtsMonthly'.
sname2plot(EbroPPtsMonthly, sname="P9001", var.type="Precipitation", dates=1,
pfreq="ma")
## Plotting seasonal precipitation at station "P9001"
par(mar=c(5.1, 4.1, 4.1, 2.1))
sname2plot(EbroPPtsMonthly, sname="P9001", FUN=sum, dates=1, pfreq="seasonal",
stype="default")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.