So I am using chemistry and precipitation data in the following two df:
chem_df
rain_df
I plotted the two datasets using ggplot() and in order to get 2 axes used the sex.axis function of the scale_y_continuous as follows:
chem_rain_fig <- ggplot() +
geom_point(data = chem_df, aes(x = Date, y = Temp)) +
geom_line(data = rain_df, aes(x = Date, y = Rain)) +
scale_y_continuous(name = "Temp", sec.axis = (.~*, name = "Rain"))
But it keeps plotting both of the data sets to the original y-axis as follows: Graph with Issue I would like to just note that the rain data is between 0-10 cm, so that is why it follows the first axis and not the secondary axis with the limit(0,10)