Description Usage Arguments Value Note Author(s) See Also Examples
View source: R/doubleHydrograph.R
Creates a ggplot hydrograph from MESH output. This function only uses
values from two MESH data frames (as read in using readOutputTimeseriesCSV
). It is assumed
that the observed data are the same in both cases - only the simulations differ.
Because this function returns a ggplot object, you can change its format in any way you like.
The plots produced may be faceted using the commands facet_wrap
or facet_grid
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | doubleHydrograph(
MESHvals1,
stationNames1 = "",
MESHname1 = "MESH1",
MESHvals2,
stationNames2 = "",
MESHname2 = "MESH2",
byStation = TRUE,
byYear = FALSE,
meas = TRUE,
sim = TRUE,
calStart = "",
calEnd = "",
alpha = 1
)
|
MESHvals1 |
Required. A data frame of output from a MESH run, as produced by |
stationNames1 |
Optional. A vector of strings holding station names. If specified, the station names will be used in the plots. Otherwise the MESH station numbers will be used. |
MESHname1 |
Optional. A string giving the name of the first MESH output. Default is "MESH1". |
MESHvals2 |
Required. A data frame of output from a MESH run, as produced by |
stationNames2 |
Optional. A vector of strings holding station names. |
MESHname2 |
Optional. A string giving the name of the second MESH output. Default is "MESH2". |
byStation |
Optional. If |
byYear |
Optional. If |
meas |
Optional. Should the measured values be plotted? Default is |
sim |
Optional. Should the simulated values be plotted? Default is |
calStart |
Optional. The start date of the calibration period. Must be a string in the format yyyy-mm-dd. If specified, values on and after this date will be designated as the |
calEnd |
Optional. The start date of the calibration period. Must be a string in the format yyyy-mm-dd. If specified, values on and after this date will be designated as the |
alpha |
Optional. Sets the alpha channel (transparency) of the plots. The default value is |
If successful, returns a ggplot2 object. If unsuccessful, returns FALSE
. The object can be facetted by the name of the station (the variable is called station
). If the option byYear = TRUE
, then the object can be facetted by the variable YEAR
.
Specifying the calibration start and/or end dates will allow the resulting plot to be facetted by the variable period
.
Kevin Shook
simpleHydrograph
read_MESH_OutputTimeseries_csv
hydroStats
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | ## Not run:
p <- doubleHydrograph(MESHvals1 = capa, MESHname1 = "CaPa precip",
MESHvals2 = kevin, MESHname2 = "Station precip", byStation = TRUE,
alpha = 0.6)
p
# facet by station
p2 <- p + facet_wrap(~station, scales = "free_y", strip.position = "right")
p2
# add scale colour
colours <- c("red", "blue", "black")
p3 <- p2 + + scale_colour_manual(values = colours)
# restrict plot to a range of dates
p3
startDate <- as.Date("2005-04-01")
endDate <- as.Date("2005-10-01")
p4 <- p3 + scale_x_date(limits = c(startDate, endDate))
p4
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.