I get the code for plotting with two y-axis from the following website:
https://www.r-bloggers.com/2015/04/r-single-plot-with-two-different-y-axes/
Here is the