I would like to add linear regression lines and their equation to my two plots.

Here is my code for the plots so far:

data_df$Date <- as.Date(data_df$Date)

# Create a line plot for ODO over time

odo_plot <- ggplot(data_df, aes(x = Date, y = ODO)) +

geom_line() +

labs(y = "ODO (mg/l)") +

theme_minimal() +

scale_x_continuous(breaks=data_df$Date)

# Create a line plot for Temperature over time

temperature_plot <- ggplot(data_df, aes(x = Date, y = Temp)) +

geom_line() +

labs(y = "Temperature °C") +

theme_minimal() +

scale_x_continuous(breaks=data_df$Date)

And this is my table with the data:

structure(list(Date = structure(c(19486, 19493, 19501, 19507,

19514, 19521), class = "Date"), ODO = c(10.1794117647059, 10.1521929824561,

9.65347222222222, 9.7942491755048, 9.0814817469419, 8.56008140350877

), Temp = c(16.3238676470588, 15.3955614035088, 17.4575297619048,

19.8056092723088, 21.3171637519113, 22.8041029005848)), row.names = c(NA,

-6L), class = c("tbl_df", "tbl", "data.frame"))

I tried to add a regression line but unfortunately it messed up my whole plot and the graph with my data and the regression line were just two horizontal lines...

Would appreciate if anyone could help me out!