-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathratios.R
107 lines (79 loc) · 2.8 KB
/
ratios.R
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
## redfield ratios
## 16 mol N per 1 mol P
## 7.23 : 1 N:P mg/L
## Trying to write my own code not edit previous code to graph the redfield ratio!!!!
Ratio <- stats3 %>%
dplyr::select(DATE,
wbid,
TP,
TN) %>%
mutate(ratio = (TN/TP)) %>%
gf_point(TN ~ TP, color = ~ wbid) +
geom_abline(slope = 7.23, size = 0.5) +
scale_color_manual(name = "Site",
values = c("Lake" = "#0072B2",
"River" = "#E69F00")) +
coord_cartesian(ylim = c(0,6.5)) +
scale_y_continuous(expand = c(0,0)) +
scale_x_continuous(expand = c(0,0)) +
theme_classic() +
theme(axis.text = element_text(color = 'black')) +
labs(x = "Total Phosphrous (mg/L)",
y = "Total Nitrogen (mg/L)")
ggsave(plot = Ratio, filename = here("output", "TNTP_ratio.png"), dpi = 120)
#-----------------##GRAPHING DIN TO DON RATIO IN THE LAKE --------------------------
# adding values for site colors
lakecolours <- c(
`MICKLERS` = "#F8766D",
`DEPGL1` = "#D89000",
`DEPGL2` = "#A3A500",
`LAKE MIDDLE` = "#39B600",
`DEPGL4` = "#00BF7D",
`LAKE SOUTH` = "#00BFC4")
rivercolours <- c(
`RIVER NORTH` = "#00B0F6",
`DEPGR1` = "#9590FF",
`GUANA RIVER` = "#E76BF3",
`DEPGR3` = "#FF62BC")
## converting site column to factor so I can use it in the graph
stats3$site <- factor(stats3$sites)
## selecting just the Lake points
lakesites <- stats3 %>%
dplyr::filter(wbid == "Lake")
riversites <- stats3 %>%
dplyr::filter(wbid == "River")
## selcting parameters that I want out of already pivotted and set
## up data set called sites
DON_DIN_Lakeratio <- lakesites %>%
dplyr::select(date_sampled,
site,
wbid,
DIN,
DON) %>%
mutate(ratio = (DIN/DON)) %>%
gf_point(DIN ~ DON, color = ~ site) +
scale_colour_manual(name = "Site", values = lakecolours) +
scale_y_continuous(expand = c(0,0)) +
scale_x_continuous(expand = c(0,0)) +
theme_classic() +
theme(axis.text = element_text(color = 'black')) +
labs(x = "DON (mg/L)",
y = "DIN (mg/L)")
ggsave(plot = DON_DIN_Lakeratio, filename = here("output", "DON_DIN_Lakeratio.png"), dpi = 120)
# DIN DON RATIO FOR RIVER
DON_DIN_Riverratio <- riversites %>%
dplyr::select(date_sampled,
site,
wbid,
DIN,
DON) %>%
mutate(ratio = (DIN/DON)) %>%
gf_point(DIN ~ DON, color = ~ site) +
scale_colour_manual(name = "Site", values = rivercolours) +
scale_y_continuous(expand = c(0,0)) +
scale_x_continuous(expand = c(0,0)) +
theme_classic() +
theme(axis.text = element_text(color = 'black')) +
labs(x = "DON (mg/L)",
y = "DIN (mg/L)")
ggsave(plot = DON_DIN_Lakeratio, filename = here("output", "DON_DIN_Riverratio.png"), dpi = 120)