Skip to content
Snippets Groups Projects
Commit 09026583 authored by Svajunas Plunge's avatar Svajunas Plunge
Browse files

title to plot_hru_pw_day

parent 1c244931
No related branches found
No related tags found
No related merge requests found
......@@ -44,6 +44,7 @@ get_hru_id_by_attribute <- function(sim_verify, lum = NULL, mgt = NULL, soil = N
#' be set in \code{run_swat_verification()}
#' @param hru_id Numeric vector with HRU ids for which variables should be plotted
#' @param var Character vector that defines the variable names that are plotted
#' @param title Character for title to be put in the figure.
#' @param years Years of the simulated data for which varaibles are plotted.
#'
#' @importFrom dplyr filter mutate select %>%
......@@ -56,7 +57,7 @@ get_hru_id_by_attribute <- function(sim_verify, lum = NULL, mgt = NULL, soil = N
#'
#' @export
#'
plot_hru_pw_day <- function(sim_verify, hru_id, var, years = 1900:2100) {
plot_hru_pw_day <- function(sim_verify, hru_id, var, title = "", years = 1900:2100) {
plot_data <- sim_verify$hru_pw_day %>%
filter(unit %in% hru_id) %>%
filter(yr %in% years) %>%
......@@ -67,7 +68,7 @@ plot_hru_pw_day <- function(sim_verify, hru_id, var, years = 1900:2100) {
ggplot(plot_data) +
geom_line(aes(x = date, y = value, color = unit, lty = unit)) +
labs(x = 'Date', color = 'HRU', lty = 'HRU') +
labs(x = 'Date', color = 'HRU', lty = 'HRU', title=title) +
scale_x_date(date_labels = '%Y-%m-%d') +
facet_grid(rows = vars(all_of(var)), scales = 'free_y', switch = 'y') +
theme_bw() +
......
......@@ -4,7 +4,7 @@
\alias{plot_hru_pw_day}
\title{Plot daily simulated variables which are saved in hru_pw_day}
\usage{
plot_hru_pw_day(sim_verify, hru_id, var, years = 1900:2100)
plot_hru_pw_day(sim_verify, hru_id, var, title = "", years = 1900:2100)
}
\arguments{
\item{sim_verify}{Simulation output of the function \code{run_swat_verification()}.
......@@ -15,6 +15,8 @@ be set in \code{run_swat_verification()}}
\item{var}{Character vector that defines the variable names that are plotted}
\item{title}{Character for title to be put in the figure.}
\item{years}{Years of the simulated data for which varaibles are plotted.}
}
\value{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment