-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNew Geochemical Data Script.R
230 lines (209 loc) · 10.5 KB
/
New Geochemical Data Script.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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
#This script graphs all geochemical data from master data file
library(ggplot2)
library(ggpubr)
library(cowplot)
setwd("~/Desktop/R_Scripts/Data")
master <- read.csv("MasterData.csv")
master$Month = factor(master$Month, levels=c("Nov '17","Dec '17","Jan '18","Feb '18","Mar '18", "Apr '18", "May '18", "Jun '18", "Jul '18", "Aug '18", "Sep '18", "Jan '19"))
DO<-ggplot(master, aes(x=master$Month, y=master$DO,
group=master$Well, color=master$Bank))+
geom_point(aes(shape=master$Well))+
theme_bw()+
geom_line(size=.5)+
labs(y="Dissolved Oxygen (ppm)", color="Bank Side", shape="Well Number")+
theme(plot.title = element_text(hjust=0.5))+
theme(axis.title.x = element_blank())+
scale_x_discrete(breaks=c("Nov '17","Dec '17","Jan '18","Feb '18","Mar '18", "Apr '18", "May '18", "Jun '18", "Jul '18", "Aug '18", "Sep '18", "Jan '19"),
labels=c("Nov","Dec","Jan","Feb","Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Jan"))+
ggtitle("NEON Well DO Values")+
scale_color_manual(values = c(Ag="black",
Pr="blue"
))+
scale_shape_manual(values=c(0,1,2,5,0,1,2,5))
NO3<-ggplot(master, aes(x=master$Month, y=master$NO3,
group=master$Well, color=master$Bank))+
geom_point(aes( shape=master$Well))+
theme_bw()+
geom_line(size=.5)+
labs(y="[NO3-N] (mg/L)", color="Bank Side", shape="Well Number")+
theme(plot.title = element_text(hjust=0.5))+
theme(axis.title.x = element_blank())+
scale_x_discrete(breaks=c("Nov '17","Dec '17","Jan '18","Feb '18","Mar '18", "Apr '18", "May '18", "Jun '18", "Jul '18", "Aug '18", "Sep '18", "Jan '19"),
labels=c("Nov","Dec","Jan","Feb","Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Jan"))+
ggtitle("NEON Well Nitrate Concentrations")+
scale_color_manual(values = c(Ag="black",
Pr="blue"
))+
scale_shape_manual(values=c(0,1,2,5,6,8,11,14))
SO4<-ggplot(master, aes(x=master$Month, y=master$SO4,
group=master$Well, color=master$Bank))+
geom_point(aes(shape=master$Well))+
theme_bw()+
geom_line(size=.5)+
labs(y="[SO4] (mg/L)", color="Bank Side", shape="Well Number")+
theme(plot.title = element_text(hjust=0.5))+
theme(axis.title.x = element_blank())+
scale_x_discrete(breaks=c("Nov '17","Dec '17","Jan '18","Feb '18","Mar '18", "Apr '18", "May '18", "Jun '18", "Jul '18", "Aug '18", "Sep '18", "Jan '19"),
labels=c("Nov","Dec","Jan","Feb","Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Jan"))+
ggtitle("NEON Well SO4 Concentrations")+
scale_color_manual(values = c(Ag="black",
Pr="blue"
))+
scale_shape_manual(values=c(0,1,2,5,6,8,11,14))
Cl<-ggplot(master, aes(x=master$Month, y=master$Cl,
group=master$Well, color=master$Bank))+
geom_point(aes(shape=master$Well))+
theme_bw()+
geom_line(size=.5)+
labs(y="[Cl] (mg/L)", color="Bank Side", shape="Well Number")+
theme(plot.title = element_text(hjust=0.5))+
theme(axis.title.x = element_blank())+
scale_x_discrete(breaks=c("Nov '17","Dec '17","Jan '18","Feb '18","Mar '18", "Apr '18", "May '18", "Jun '18", "Jul '18", "Aug '18", "Sep '18", "Jan '19"),
labels=c("Nov","Dec","Jan","Feb","Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Jan"))+
ggtitle("NEON Well Chloride Concentrations")+
scale_color_manual(values = c(Ag="black",
Pr="blue"
))+
scale_shape_manual(values=c(0,1,2,5,6,8,11,14))
Temp<-ggplot(master, aes(x=master$Month, y=master$Temperature,
group=master$Well, color=master$Bank))+
geom_point(aes(shape=master$Well))+
theme_bw()+
geom_line(size=.5)+
labs(y="Water Temperature (C)", color="Bank Side", shape="Well Number")+
theme(plot.title = element_text(hjust=0.5))+
theme(axis.title.x = element_blank())+
scale_x_discrete(breaks=c("Nov '17","Dec '17","Jan '18","Feb '18","Mar '18", "Apr '18", "May '18", "Jun '18", "Jul '18", "Aug '18", "Sep '18", "Jan '19"),
labels=c("Nov","Dec","Jan","Feb","Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Jan"))+
ggtitle("NEON Well Water Temperatures")+
scale_color_manual(values = c(Ag="black",
Pr="blue"
))+
scale_shape_manual(values=c(0,1,2,5,6,8,11,14))
pH<-ggplot(master, aes(x=master$Month, y=master$pH,
group=master$Well, color=master$Bank))+
geom_point(aes(shape=master$Well))+
theme_bw()+
geom_line(size=.5)+
labs(y="Water pH", color="Bank Side", shape="Well Number")+
theme(plot.title = element_text(hjust=0.5))+
theme(axis.title.x = element_blank())+
scale_x_discrete(breaks=c("Nov '17","Dec '17","Jan '18","Feb '18","Mar '18", "Apr '18", "May '18", "Jun '18", "Jul '18", "Aug '18", "Sep '18", "Jan '19"),
labels=c("Nov","Dec","Jan","Feb","Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Jan"))+
ggtitle("NEON Well pH Values")+
scale_color_manual(values = c(Ag="black",
Pr="blue"
))+
scale_shape_manual(values=c(0,1,2,5,6,8,11,14))
SPC<-ggplot(master, aes(x=master$Month, y=master$Conductivity,
group=master$Well, color=master$Bank))+
geom_point(aes(shape=master$Well))+
theme_bw()+
geom_line(size=.5)+
labs(y="Specific Conductance (us/cm)", color="Bank Side", shape="Well Number")+
theme(plot.title = element_text(hjust=0.5))+
theme(axis.title.x = element_blank())+
scale_x_discrete(breaks=c("Nov '17","Dec '17","Jan '18","Feb '18","Mar '18", "Apr '18", "May '18", "Jun '18", "Jul '18", "Aug '18", "Sep '18", "Jan '19"),
labels=c("Nov","Dec","Jan","Feb","Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Jan"))+
ggtitle("NEON Well SPC Values")+
scale_color_manual(values = c(Ag="black",
Pr="blue"
))+
scale_shape_manual(values=c(0,1,2,5,6,8,11,14))
Alk<-ggplot(master, aes(x=master$Month, y=master$Alkalinity,
group=master$Well, color=master$Bank))+
geom_point(aes(shape=master$Well))+
theme_bw()+
geom_line(size=.5)+
labs(y="Alkalinity (mgCO3/L)", color="Bank Side", shape="Well Number")+
theme(plot.title = element_text(hjust=0.5))+
theme(axis.title.x = element_blank())+
scale_x_discrete(breaks=c("Nov '17","Dec '17","Jan '18","Feb '18","Mar '18", "Apr '18", "May '18", "Jun '18", "Jul '18", "Aug '18", "Sep '18", "Jan '19"),
labels=c("Nov","Dec","Jan","Feb","Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Jan"))+
ggtitle("NEON Well Alkalinity")+
scale_color_manual(values = c(Ag="black",
Pr="blue"
))+
scale_shape_manual(values=c(0,1,2,5,6,8,11,14))
Ca<-ggplot(master, aes(x=master$Month, y=master$Ca,
group=master$Well, color=master$Bank))+
geom_point(aes(shape=master$Well))+
theme_bw()+
geom_line(size=.5)+
labs(y="[Ca] (mg/L)", color="Bank Side", shape="Well Number")+
theme(plot.title = element_text(hjust=0.5))+
theme(axis.title.x = element_blank())+
scale_x_discrete(breaks=c("Nov '17","Dec '17","Jan '18","Feb '18","Mar '18", "Apr '18", "May '18", "Jun '18", "Jul '18", "Aug '18", "Sep '18", "Jan '19"),
labels=c("Nov","Dec","Jan","Feb","Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Jan"))+
ggtitle("NEON Well Calcium Concentrations")+
scale_color_manual(values = c(Ag="black",
Pr="blue"
))+
scale_shape_manual(values=c(0,1,2,5,6,8,11,14))
K<-ggplot(master, aes(x=master$Month, y=master$K,
group=master$Well, color=master$Bank))+
geom_point(aes(shape=master$Well))+
theme_bw()+
geom_line(size=.5)+
labs(y="[K] (mg/L)", color="Bank Side", shape="Well Number")+
theme(plot.title = element_text(hjust=0.5))+
theme(axis.title.x = element_blank())+
scale_x_discrete(breaks=c("Nov '17","Dec '17","Jan '18","Feb '18","Mar '18", "Apr '18", "May '18", "Jun '18", "Jul '18", "Aug '18", "Sep '18", "Jan '19"),
labels=c("Nov","Dec","Jan","Feb","Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Jan"))+
ggtitle("NEON Well Potassium Concentrations")+
scale_color_manual(values = c(Ag="black",
Pr="blue"
))+
scale_shape_manual(values=c(0,1,2,5,6,8,11,14))
Mg<-ggplot(master, aes(x=master$Month, y=master$Mg,
group=master$Well, color=master$Bank))+
geom_point(aes(shape=master$Well))+
theme_bw()+
geom_line(size=.5)+
labs(y="[Mg] (mg/L)", color="Bank Side", shape="Well Number")+
theme(plot.title = element_text(hjust=0.5))+
theme(axis.title.x = element_blank())+
scale_x_discrete(breaks=c("Nov '17","Dec '17","Jan '18","Feb '18","Mar '18", "Apr '18", "May '18", "Jun '18", "Jul '18", "Aug '18", "Sep '18", "Jan '19"),
labels=c("Nov","Dec","Jan","Feb","Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Jan"))+
ggtitle("NEON Well Magensium Concentrations")+
scale_color_manual(values = c(Ag="black",
Pr="blue"
))+
scale_shape_manual(values=c(0,1,2,5,6,8,11,14))
Na<-ggplot(master, aes(x=master$Month, y=master$Na,
group=master$Well, color=master$Bank))+
geom_point(aes(shape=master$Well))+
theme_bw()+
geom_line(size=.5)+
labs(y="[Na] (mg/L)", color="Bank Side", shape="Well Number")+
theme(plot.title = element_text(hjust=0.5))+
theme(axis.title.x = element_blank())+
scale_x_discrete(breaks=c("Nov '17","Dec '17","Jan '18","Feb '18","Mar '18", "Apr '18", "May '18", "Jun '18", "Jul '18", "Aug '18", "Sep '18", "Jan '19"),
labels=c("Nov","Dec","Jan","Feb","Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Jan"))+
ggtitle("NEON Well Sodium Concentrations")+
scale_color_manual(values = c(Ag="black",
Pr="blue"
))+
scale_shape_manual(values=c(0,1,2,5,6,8,11,14))
#This portion of code creates figure arrays for all pertinent anions,
#cations, and field parameters
anions<- ggarrange(NO3, SO4, Cl, Alk,
common.legend = TRUE, legend="bottom",
ncol=2, nrow=2)
cations<- ggarrange(Ca, K, Mg, Na,
common.legend = TRUE, legend="bottom",
ncol=2, nrow=2)
fieldpar<- ggarrange(DO, pH, SPC,
common.legend = TRUE, legend="bottom",
ncol=2, nrow=2)
#This section will save the figure arrays as pdf files
setwd("~/Desktop/R_Scripts/Figures")
pdf("Anion_Summary.pdf")
print(anions)
dev.off()
pdf("Cation_Summary.pdf")
print(cations)
dev.off()
pdf("Parameter_Summary.pdf")
print(fieldpar)
dev.off()