-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflow_figs.Rmd
More file actions
75 lines (63 loc) · 2.07 KB
/
flow_figs.Rmd
File metadata and controls
75 lines (63 loc) · 2.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
---
title: "hydrograph figures"
author: "Megan Sears"
date: "`r Sys.Date()`"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
library(tidyverse)
library(plotly)
```
```{r}
flow <- read_csv('./38HRU_dec2024_updates/discharge_all.csv') %>%
replace(.==-9999, NA) %>%
rename(date = time) %>%
mutate(date = mdy(date)) %>%
drop_na()
flow_pivot <- flow %>%
pivot_longer(!date, names_to = 'cal_run', values_to = 'q_m3s') %>%
mutate(year = as.factor(year(date))) %>%
filter(cal_run %in% c('grid_all',
'statn_all',
'obs')) %>%
mutate(cal_run = case_match(cal_run,
'grid_all' ~ 'Gridded',
'statn_all' ~ 'Station',
'obs' ~ 'Observed'))
flowEg <- flow_pivot %>%
filter(year %in% c(2016)) %>%
ggplot(aes(x = date,
y = q_m3s,
color = cal_run,
linetype = cal_run)) +
geom_line(size = 1, alpha = 1) +
theme_bw(base_size = 20) +
scale_color_manual(values = c("Gridded" = "#0047AB",
"Observed" = "black",
"Station" = "orange")) +
scale_linetype_manual(values = c("Gridded" = "solid",
"Observed" = "dashed",
"Station" = "solid")) +
labs(x = element_blank(),
y = "Streamflow (cms)") +
scale_x_date(date_labels = "%b",
date_breaks = "1 month") +
theme(
legend.position = c(0.9, 0.9),
legend.text = element_text(size = 16),
legend.key.width = unit(2, "lines"),
legend.title = element_blank(),
panel.grid = element_blank(),
panel.background = element_rect(fill = "white"),
strip.background = element_blank(),
text = element_text(color = "black"),
axis.title = element_text(color = "black"),
axis.text = element_text(color = "black")
)
flowEg
ggsave('/Users/megansears/Documents/Repos/fourmile/figures/2016_flowEg.png',
dpi=600,
width = 12,
height = 8)
```