Commit f95a3be1 authored by Dorchies David's avatar Dorchies David
Browse files

Some bug fixes:

- issue for displaying ggplot
- reduce dependency list
- fix bugs introduced by me
parent e9685a8a
1 merge request!2Calculate filling rule curve based on mSPA
Showing with 11 additions and 26 deletions
+11 -26
library("pacman")
library(hydroTSM)
library(reshape2)
pacman::p_load(
pacman,
dplyr,
GGally,
ggplot2,
ggthemes,
ggvis,
httr,
lubridate,
plotly,
rio,
rmarkdown,
shiny,
stringr,
tidyr
)
library(ggplot2)
library(readr)
data <- readr::read_delim(
file = "https://raw.githubusercontent.com/infohquan/link/master/inputdata_b.txt",
delim = "\t"
delim = "\t", col_names = c("inflow", "release", "precip", "evapo", "downstreamFlow")
)
time <-
......@@ -43,11 +26,11 @@ year <-
"%Y"
))
n <- NROW(na.omit(data))
Inflow <- data[, 1]
dem <- data[, 2]
prec <- data[, 3]
eva <- data[, 4]
netev <- (data[, 4] - data[, 3]) / 1000
Inflow <- data$inflow
dem <- data$release
prec <- data$precip
eva <- data$evapo
netev <- (data$evapo - data$precip) / 1000
rule_curve <- c(34, 50, 63, 73, 77, 79, 80, 63, 46, 29, 12, 21)
DS <- rep(8.5, 12)
capacity <- rep(82.5, 12)
......@@ -155,7 +138,8 @@ result$Month = factor(
result.gather <-
gather(result, key = "Rule Curve", value = IndexValue, -Month)
ggplot(result.gather,
print(
ggplot2::ggplot(result.gather,
aes(Month, IndexValue, group = `Rule Curve`, color = `Rule Curve`)) +
ylim(0, 85) +
geom_line(aes(y = IndexValue), lwd = 1.2) +
......@@ -164,3 +148,4 @@ ggplot(result.gather,
x = "") + theme_few(base_size = 20) +
scale_color_brewer(palette = "Set2") +
theme(plot.title = element_text(hjust = 0.5))
)
\ No newline at end of file
Supports Markdown
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