I am currently graphing river discharge behind water quality measures such as salinty and pH.
This is the graphs of salinity and pH by themselves:
salinity and pH
(the NA in the site is a bit inevitable i think as I had to match it to discharge data by hour so there are a lot of NAs , when I removed it it also removed a lot of the discharge data.)
Here is the code for salinity:
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"))
Sal
the red line is the government guideline for water quality.
Now when i add the discharge graph the scale for the y axis with Salinty and pH goes to 0 so they are plotted really small.
[
Salinity here](https://i.sstatic.net/bqMvWCUr.png) and pH here
I tried ylim() however I got this message:
Scale for y is already present.
Adding another scale for y, which will replace the existing scale.
Code for second salinity graph:
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))
any help would be appreciated !
cheers.
- plot two y axis scale changed to zero on first