Here is one attempt. I took the data from your other post and made a lake2 set by simply copying lake1 and changing the label.
library(lubridate)
library(tibble)
library(dplyr)
library(ggplot2)
tpexample <- tibble::tribble(
~lake, ~source, ~date, ~parm, ~value, ~unit,
"lake1", "lakewatch", "30-Jul-92", "tp", 0.06, "mg/L",
"lake1", "lakewatch", "18-Aug-92", "tp", 0.07, "mg/L",
"lake1", "lakewatch", "29-Sep-92", "tp", 0.13, "mg/L",
"lake1", "lakewatch", "29-Oct-92", "tp", 0.1, "mg/L",
"lake1", "lakewatch", "16-Nov-92", "tp", 0.16, "mg/L",
"lake1", "lakewatch", "16-Dec-92", "tp", 0.13, "mg/L",
"lake1", "lakewatch", "19-Jan-93", "tp", 0.09, "mg/L",
"lake1", "lakewatch", "10-Feb-93", "tp", 0.09, "mg/L",
"lake1", "lakewatch", "24-Mar-93", "tp", 0.05, "mg/L",
"lake1", "lakewatch", "28-Apr-93", "tp", 0.05, "mg/L",
"lake1", "lakewatch", "28-May-93", "tp", 0.04, "mg/L",
"lake1", "lakewatch", "29-Jun-93", "tp", 0.04, "mg/L",
"lake1", "lakewatch", "29-Jul-93", "tp", 0.04, "mg/L",
"lake1", "lakewatch", "20-Aug-93", "tp", 0.03, "mg/L",
"lake1", "lakewatch", "27-Sep-93", "tp", 0.03, "mg/L",
"lake1", "lakewatch", "20-Oct-93", "tp", 0.04, "mg/L",
"lake1", "lakewatch", "22-Nov-93", "tp", 0.04, "mg/L",
"lake1", "lakewatch", "22-Dec-93", "tp", 0.05, "mg/L",
"lake1", "lakewatch", "26-Jan-94", "tp", 0.06, "mg/L",
"lake1", "lakewatch", "23-Feb-94", "tp", 0.05, "mg/L",
"lake1", "lakewatch", "23-Mar-94", "tp", 0.04, "mg/L",
"lake1", "lakewatch", "27-Apr-94", "tp", 0.03, "mg/L",
"lake1", "lakewatch", "28-Jun-94", "tp", 0.05, "mg/L",
"lake1", "lakewatch", "9-Jul-94", "tp", 0.05, "mg/L",
"lake1", "lakewatch", "5-Oct-94", "tp", 0.08, "mg/L",
"lake1", "lakewatch", "1-Nov-94", "tp", 0.09, "mg/L",
"lake1", "lakewatch", "22-Dec-94", "tp", 0.11, "mg/L",
"lake1", "lakewatch", "31-Jan-95", "tp", 0.1, "mg/L",
"lake1", "lakewatch", "16-Feb-95", "tp", 0.08, "mg/L",
"lake1", "lakewatch", "14-Mar-95", "tp", 0.08, "mg/L",
"lake1", "lakewatch", "13-Apr-95", "tp", 0.06, "mg/L",
"lake1", "lakewatch", "11-May-95", "tp", 0.05, "mg/L",
"lake1", "lakewatch", "20-Jun-95", "tp", 0.03, "mg/L",
"lake1", "lakewatch", "25-Jul-95", "tp", 0.03, "mg/L",
"lake1", "lakewatch", "21-Aug-95", "tp", 0.17, "mg/L",
"lake1", "lakewatch", "12-Sep-95", "tp", 0.15, "mg/L",
"lake1", "lakewatch", "16-Oct-95", "tp", 0.1, "mg/L",
"lake1", "lakewatch", "14-Nov-95", "tp", 0.1, "mg/L",
"lake1", "lakewatch", "12-Dec-95", "tp", 0.06, "mg/L",
"lake1", "lakewatch", "23-Jan-96", "tp", 0.05, "mg/L",
"lake1", "lakewatch", "15-Feb-96", "tp", 0.07, "mg/L",
"lake1", "lakewatch", "20-Mar-96", "tp", 0.06, "mg/L",
"lake2", "lakewatch", "30-Jul-92", "tp", 0.06, "mg/L",
"lake2", "lakewatch", "18-Aug-92", "tp", 0.07, "mg/L",
"lake2", "lakewatch", "29-Sep-92", "tp", 0.13, "mg/L",
"lake2", "lakewatch", "29-Oct-92", "tp", 0.1, "mg/L",
"lake2", "lakewatch", "16-Nov-92", "tp", 0.16, "mg/L",
"lake2", "lakewatch", "16-Dec-92", "tp", 0.13, "mg/L",
"lake2", "lakewatch", "19-Jan-93", "tp", 0.09, "mg/L",
"lake2", "lakewatch", "10-Feb-93", "tp", 0.09, "mg/L",
"lake2", "lakewatch", "24-Mar-93", "tp", 0.05, "mg/L",
"lake2", "lakewatch", "28-Apr-93", "tp", 0.05, "mg/L",
"lake2", "lakewatch", "28-May-93", "tp", 0.04, "mg/L",
"lake2", "lakewatch", "29-Jun-93", "tp", 0.04, "mg/L",
"lake2", "lakewatch", "29-Jul-93", "tp", 0.04, "mg/L",
"lake2", "lakewatch", "20-Aug-93", "tp", 0.03, "mg/L",
"lake2", "lakewatch", "27-Sep-93", "tp", 0.03, "mg/L",
"lake2", "lakewatch", "20-Oct-93", "tp", 0.04, "mg/L",
"lake2", "lakewatch", "22-Nov-93", "tp", 0.04, "mg/L",
"lake2", "lakewatch", "22-Dec-93", "tp", 0.05, "mg/L",
"lake2", "lakewatch", "26-Jan-94", "tp", 0.06, "mg/L",
"lake2", "lakewatch", "23-Feb-94", "tp", 0.05, "mg/L",
"lake2", "lakewatch", "23-Mar-94", "tp", 0.04, "mg/L",
"lake2", "lakewatch", "27-Apr-94", "tp", 0.03, "mg/L",
"lake2", "lakewatch", "28-Jun-94", "tp", 0.05, "mg/L",
"lake2", "lakewatch", "9-Jul-94", "tp", 0.05, "mg/L",
"lake2", "lakewatch", "5-Oct-94", "tp", 0.08, "mg/L",
"lake2", "lakewatch", "1-Nov-94", "tp", 0.09, "mg/L",
"lake2", "lakewatch", "22-Dec-94", "tp", 0.11, "mg/L",
"lake2", "lakewatch", "31-Jan-95", "tp", 0.1, "mg/L",
"lake2", "lakewatch", "16-Feb-95", "tp", 0.08, "mg/L",
"lake2", "lakewatch", "14-Mar-95", "tp", 0.08, "mg/L",
"lake2", "lakewatch", "13-Apr-95", "tp", 0.06, "mg/L",
"lake2", "lakewatch", "11-May-95", "tp", 0.05, "mg/L",
"lake2", "lakewatch", "20-Jun-95", "tp", 0.03, "mg/L",
"lake2", "lakewatch", "25-Jul-95", "tp", 0.03, "mg/L",
"lake2", "lakewatch", "21-Aug-95", "tp", 0.17, "mg/L",
"lake2", "lakewatch", "12-Sep-95", "tp", 0.15, "mg/L",
"lake2", "lakewatch", "16-Oct-95", "tp", 0.1, "mg/L",
"lake2", "lakewatch", "14-Nov-95", "tp", 0.1, "mg/L",
"lake2", "lakewatch", "12-Dec-95", "tp", 0.06, "mg/L",
"lake2", "lakewatch", "23-Jan-96", "tp", 0.05, "mg/L",
"lake2", "lakewatch", "15-Feb-96", "tp", 0.07, "mg/L",
"lake2", "lakewatch", "20-Mar-96", "tp", 0.06, "mg/L"
)
tpexample <- tpexample %>% mutate(date = dmy(date),
year = year(date))
GeomMean2 <- tpexample %>% group_by(year) %>%
summarize(GMean = exp(mean(log(value))), MeanDate = mean(date)) %>%
mutate(GeomMean = " ")
tpexample %>% ggplot() +
geom_point(mapping =aes(x=date, y=value, color=source)) +
geom_point(mapping = aes(MeanDate, GMean), data = GeomMean2, size = 1, color = "red") +
geom_line(mapping = aes(MeanDate, GMean, linetype = GeomMean), data = GeomMean2, size = 1, color = "purple") +
theme(legend.position = "bottom") +
facet_wrap(~lake, ncol=1, scales= "free")
![](https://forum.posit.co/uploads/default/original/3X/f/8/f87428a371874e72d4ec850ad13cbcb2d565718b.png)
Created on 2020-11-16 by the reprex package (v0.2.1)