-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplot_event_values.R
More file actions
39 lines (31 loc) · 1.27 KB
/
plot_event_values.R
File metadata and controls
39 lines (31 loc) · 1.27 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
# Function to produce plots of data from selected days from desired event
# analysis_data = dataframe produced by MainAnalysis.R script (l. 161-163)
# event_number = desired event for plots
# dAGWR_range = range, in either direction from 1, that is a valid dAGWR
plot_event_values <- function(analysis_data,
event_number,
dAGWR_range = 0.03){
data <- analysis_data
eventnum <- event_number
# Get event data using previous function
event <- summarize_event(data, event_number)[[1]]
# log flow plot
a <- ggplot(data = event, mapping = aes(x = Date, y = log(Flow)))+
geom_point(color = "dodgerblue4")+
geom_line(color = "dodgerblue3")+
theme_bw()
# AGWR valid plot
b <- ggplot(data = event, mapping = aes(x = Date, y = AGWR))+
geom_point(color = "firebrick4")+
geom_line(color = "firebrick")+
theme_bw()
# dAGWR valid plot
c <- ggplot(data = event, mapping = aes(x = Date, y = delta_AGWR))+
geom_point(color = "darkolivegreen")+
geom_line(color = "darkolivegreen4")+
theme_bw()
d <- gridExtra::grid.arrange(a, b, c, ncol=1, top=paste0("Event ", event_number, " Selected Dates"))
return(d)
}
# Example of how to run function
# plot.event.values(analysis_S, 99)