library(dplyr)
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
library(lubridate)
##
## Attaching package: 'lubridate'
## The following objects are masked from 'package:base':
##
## date, intersect, setdiff, union
library(ggplot2)
library(readxl)
CHEM_RESULTS <- read_excel("CHEM RESULTS.xlsx",
sheet = "discharge graphs")
View(CHEM_RESULTS)
ggplot(CHEM_RESULTS, aes(x= `Timestamp`, y=`cumec`, group = 1)) +
geom_line(color="powderblue", linewidth=1, alpha=0.9, linetype=1)
CHEM_RESULTS=CHEM_RESULTS %>%
mutate(`Timestamp`=ymd_hms(`Timestamp`,tz="Etc/GMT-10"))
## Date in ISO8601 format; converting timezone from UTC to "Etc/GMT-10".
graph1<-ggplot(CHEM_RESULTS, aes(x= `Timestamp`, y=`cumec`, group = 1)) +
scale_x_datetime(date_breaks = "2 weeks", date_labels = "%b %Y",limits = c(min(CHEM_RESULTS$Timestamp), max(CHEM_RESULTS$Timestamp)), expand = c(0, 0)) +
geom_line(color="powderblue", linewidth=1, alpha=0.9, linetype=1)
basegraph<-graph1+xlab("Date")+ylab("Discharge (cumec)")
basegraph
Manipulating to get second axis and add second graph !
Ent_data<-ggplot(CHEM_RESULTS, aes(x= `Timestamp`, y= `Enterococci (CFU/100 mL)`,
col=Site))+
geom_hline(aes(yintercept=60), lty=2, col="red")+
geom_line(size=1, alpha=0.9, linetype=1, na.rm = TRUE)+
geom_point(na.rm = TRUE)+
scale_color_manual(values=c("orchid4","darkorange","royalblue4", "steelblue1"))
## Warning: Using `size` aesthetic for lines was deprecated in ggplot2 3.4.0.
## ℹ Please use `linewidth` instead.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.
Ent_data
(on most of the graphs to follow the legend will be removed as one will be added in the corner of the doccument to save space)
Ent_data+ scale_y_continuous(sec.axis = sec_axis(~ ./10))
scale=10
Ent_data+
geom_line(aes(y = cumec*scale), color="powderblue", linewidth=1, alpha=0.4,
linetype=1)+
scale_y_continuous(sec.axis = sec_axis(~./10, name="Discharge (cumec)"))+
ggtitle("Enterococci Levels in Gold Coast Broadwater (Yugambeh Country) Against
Nerang River Discharge") +
xlab("Date")+
theme(text = element_text(family = "Times New Roman", size= 14))+
theme(legend.position="none")
NOx<-ggplot(CHEM_RESULTS, aes(x= `Timestamp`, y= `N as NOx (ug/L)`, col=Site))+
geom_hline(aes(yintercept=1), lty=2, col="red")+
geom_line(size=1, alpha=0.9, linetype=1, na.rm = TRUE)+
geom_point(na.rm = TRUE)+
scale_color_manual(values=c("orchid4","darkorange","royalblue4", "steelblue1"))
NOx
Median value from WQ1463 Broadwater: low flow, Southern Broadwater, Lower Estuary, Slightly Disturbed it is the WQ objective guideline shown in Red. The Broadwater guidelines are more conservative then Nerang Guidelines. conductivity had a median of 49124 (µS/cm) for all sites/date. Therefore, median is pertaining to lowflow conditions Conductivity ≥45,000 µS/cm from WQ1463.
NOx+ scale_y_continuous(sec.axis = sec_axis(~ ./3))
scale=3
NOx+
geom_line(aes(y = cumec*scale), color="powderblue", linewidth=1, alpha=0.4,
linetype=1)+
scale_y_continuous(sec.axis = sec_axis(~./3, name="Discharge (cumec)"))+
ggtitle("NOx Concentration in Gold Coast Broadwater (Yugambeh Country) Against
Nerang River Discharge") +
xlab("Date")+
theme(text = element_text(family = "Times New Roman", size= 14))+
theme(legend.position="none")
TN<-ggplot(CHEM_RESULTS, aes(x= `Timestamp`, y=`Total Dissolved N (ug/L)`,
col=Site))+
geom_hline(aes(yintercept=130), lty=2, col="red")+
geom_line(size=1, alpha=0.9, linetype=1, na.rm = TRUE)+
geom_point(na.rm = TRUE)+
scale_color_manual(values=c("orchid4","darkorange","royalblue4", "steelblue1"))
TN
TN+ scale_y_continuous(sec.axis = sec_axis(~ ./10))
scale=10
TN+
geom_line(aes(y = cumec*scale), color="powderblue", linewidth=1, alpha=0.4,
linetype=1)+
scale_y_continuous(sec.axis = sec_axis(~./10, name="Discharge (cumec)"))+
ggtitle("Total Dissolved Nitrogen Concentration in Gold Coast Broadwater
(Yugambeh Country) Against Nerang River Discharge") +
xlab("Date")+
theme(text = element_text(family = "Times New Roman", size= 14))+
theme(legend.position="none")
TP<-ggplot(CHEM_RESULTS, aes(x= `Timestamp`, y=`Total Dissolved P (ug/L)`,
col=Site))+
geom_hline(aes(yintercept=11), lty=2, col="red")+
geom_line(size=1, alpha=0.9, linetype=1, na.rm = TRUE)+
geom_point(na.rm = TRUE)+
scale_color_manual(values=c("orchid4","darkorange","royalblue4", "steelblue1"))
TP
TP+ scale_y_continuous(sec.axis = sec_axis(~ ./3.5))
scale=3.5
TP+
geom_line(aes(y = cumec*scale), color="powderblue", linewidth=1, alpha=0.4,
linetype=1)+
scale_y_continuous(sec.axis = sec_axis(~./3.5, name="Discharge (cumec)"))+
ggtitle("Total Dissolved Phosphorus Concentration in Gold Coast
Broadwater (Yugambeh Country) Against Nerang River Discharge") +
xlab("Date")+
theme(text = element_text(family = "Times New Roman", size= 14))+
theme(legend.position="none")
P04<-ggplot(CHEM_RESULTS, aes(x= `Timestamp`, y=`P as P04 (ug/L)`,
col=Site))+
geom_hline(aes(yintercept=3), lty=2, col="red")+
geom_line(size=1, alpha=0.9, linetype=1, na.rm = TRUE)+
geom_point(na.rm = TRUE)+
scale_color_manual(values=c("orchid4","darkorange","royalblue4", "steelblue1"))
P04
P04+ scale_y_continuous(sec.axis = sec_axis(~ ./1))
scale=1
P04+
geom_line(aes(y = cumec*scale), color="powderblue", linewidth=1, alpha=0.4,
linetype=1)+
scale_y_continuous(sec.axis = sec_axis(~./1, name="Discharge (cumec)"))+
ggtitle("P as P04 Concentration in Gold Coast Broadwater
(Yugambeh Country) Against Nerang River Discharge") +
xlab("Date")+
theme(text = element_text(family = "Times New Roman", size= 14))+
theme(legend.position="none")
NH4<-ggplot(CHEM_RESULTS, aes(x= `Timestamp`, y=`N as NH4 (ug/L)`,
col=Site))+
geom_hline(aes(yintercept=2), lty=2, col="red")+
geom_line(size=1, alpha=0.9, linetype=1, na.rm = TRUE)+
geom_point(na.rm = TRUE)+
scale_color_manual(values=c("orchid4","darkorange","royalblue4", "steelblue1"))
NH4
NH4+ scale_y_continuous(sec.axis = sec_axis(~ ./2))
scale=2
NH4+
geom_line(aes(y = cumec*scale), color="powderblue", linewidth=1, alpha=0.4,
linetype=1)+
scale_y_continuous(sec.axis = sec_axis(~./2, name="Discharge (cumec)"))+
ggtitle("N as NH4 Concentration in Gold Coast Broadwater
(Yugambeh Country) Against Nerang River Discharge") +
xlab("Date")+
theme(text = element_text(family = "Times New Roman", size= 14))+
theme(legend.position="none")
Tur<-ggplot(CHEM_RESULTS, aes(x= `Timestamp`, y=`Turbidity`,
col=Site))+
geom_hline(aes(yintercept=1), lty=2, col="red")+
geom_line(size=1, alpha=0.9, linetype=1, na.rm = TRUE)+
geom_point(na.rm = TRUE)+
scale_color_manual(values=c("orchid4","darkorange","royalblue4", "steelblue1"))
Tur
Tur+ scale_y_continuous(sec.axis = sec_axis(~ ./0.1))
scale=0.1
Tur+
geom_line(aes(y = cumec*scale), color="powderblue", linewidth=1, alpha=0.4,
linetype=1)+
scale_y_continuous(sec.axis = sec_axis(~./0.1, name="Discharge (cumec)"))+
ggtitle("Turbidity in Gold Coast Broadwater
(Yugambeh Country) Against Nerang River Discharge") +
xlab("Date")+
theme(text = element_text(family = "Times New Roman", size= 14))+
theme(legend.position="none")
DO<-ggplot(CHEM_RESULTS, aes(x= `Timestamp`, y=`Dissolved oxygen (% saturation)`,
col=Site))+
geom_hline(aes(yintercept=100), lty=2, col="red")+
geom_line(size=1, alpha=0.9, linetype=1, na.rm = TRUE)+
geom_point(na.rm = TRUE)+
scale_color_manual(values=c("orchid4","darkorange","royalblue4", "steelblue1"))+
theme(legend.position="none")+
ggtitle("Dissolved Oxygen leves in Four Sites along the Gold Coast
Broadwater (Yugambeh Country)")+
theme(text = element_text(family = "Times New Roman", size= 14))
DO
DO+ scale_y_continuous(sec.axis = sec_axis(~ ./3.5))
scale=3.5
DO+
geom_line(aes(y = cumec*scale), color="powderblue", linewidth=1, alpha=0.4,
linetype=1)+
scale_y_continuous(sec.axis = sec_axis(~./3.5, name="Discharge (cumec)"))+
ggtitle("Dissolved Oxygen % Saturation in Gold Coast Broadwater
(Yugambeh Country) Against Nerang River Discharge") +
xlab("Date")+
theme(text = element_text(family = "Times New Roman", size= 14))+
theme(legend.position="none")
pH<-ggplot(CHEM_RESULTS, aes(x= `Timestamp`, y=`pH`,
col=Site))+
geom_hline(aes(yintercept=8.2), lty=2, col="red")+
geom_line(size=1, alpha=0.9, linetype=1, na.rm = TRUE)+
geom_point(na.rm = TRUE)+
scale_color_manual(values=c("orchid4","darkorange","royalblue4", "steelblue1"))+
theme(legend.position="none")+
ggtitle("pH at Four Sites Along Gold Coast Broadwater
(Yugambeh Country)")+
theme(text = element_text(family = "Times New Roman", size= 14))
pH
pH+ scale_y_continuous(sec.axis = sec_axis(~ ./0.3))
scale=0.3
pH+
geom_line(aes(y = cumec*scale), color="powderblue", linewidth=1, alpha=0.4,
linetype=1)+
scale_y_continuous(sec.axis = sec_axis(~./0.3, name="Discharge (cumec)"))+
ggtitle("pH in Gold Coast Broadwater
(Yugambeh Country) Against Nerang River Discharge") +
xlab("Date")+
theme(text = element_text(family = "Times New Roman", size= 14))+
theme(legend.position="none")
guideline from Dunn et al., 2012
Sal<-ggplot(CHEM_RESULTS, aes(x= `Timestamp`, y=`Salinity`,
col=Site))+
geom_hline(aes(yintercept=34), lty=2, col="red")+
geom_line(size=1, alpha=0.9, linetype=1, na.rm = TRUE)+
geom_point(na.rm = TRUE)+
scale_color_manual(values=c("orchid4","darkorange","royalblue4", "steelblue1"))+
theme(legend.position="none")
Sal
Sal+ scale_y_continuous(sec.axis = sec_axis(~ ./1))
scale=1
Sal+
ylim(20,35)+
geom_line(aes(y = cumec*scale), color="powderblue", linewidth=1, alpha=0.4,
linetype=1)+
scale_y_continuous(sec.axis = sec_axis(~./1, name="Discharge (cumec)"))+
ggtitle("Salinity Saturation in Gold Coast Broadwater
(Yugambeh Country) Against Nerang River Discharge") +
xlab("Date")+
theme(text = element_text(family = "Times New Roman", size= 14))+
theme(legend.position="none")
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
from Dunn et al, 2012 Insufficient Data WQO
TSS<-ggplot(CHEM_RESULTS, aes(x= `Timestamp`, y=`Total Suspended Solids (mg/L)`,
col=Site))+
geom_line(size=1, alpha=0.9, linetype=1, na.rm = TRUE)+
geom_point(na.rm = TRUE)+
scale_color_manual(values=c("orchid4","darkorange","royalblue4", "steelblue1"))+
xlab("Date")+
theme(text = element_text(family = "Times New Roman", size= 14))+
ggtitle("Total Suspended Solids in Gold Coast Broadwater
(Yugambeh Country)")+
theme(legend.position="none")
TSS