I have measured the emission of two compounds acetone and acetaldehyde nine times across 116 days. I made a graph like this:
The measurements are divided into three groups: a, b and c.
I'm trying to plot the average (and standard error) of group b and c in the graph as well. This symbol would have to be different.
Any ideas?
The data looks like this
df <- structure(list(compound = c("Acetaldehyde", "Acetaldehyde", "Acetaldehyde",
"Acetaldehyde", "Acetaldehyde", "Acetaldehyde", "Acetaldehyde",
"Acetaldehyde", "Acetaldehyde", "Acetone", "Acetone", "Acetone",
"Acetone", "Acetone", "Acetone", "Acetone", "Acetone", "Acetone"
), days = c(0, 4, 10, 17, 24, 66, 81, 94, 116, 0, 4, 10, 17,
24, 66, 81, 94, 116), emission = c(26.13, 59.09, 45, 11.41, 6.71,
0.07, 0, 0.53, 0.56, 28.47, 46.65, 44.03, 56.68, 29.08, 2.73,
7.72, 0.38, 0.21), se = c(5.88, 11.04, 11.4, 4.31, 3.54, 0.03,
0, 0.25, 0.31, 7.44, 8.98, 9.92, 22.79, 13.83, 1.2, 6.38, 0.09,
0.07), group = c("a", "b", "b", "b", "b", "b", "c", "c", "c",
"a", "b", "b", "b", "b", "b", "c", "c", "c")), row.names = c(NA,
-18L), class = "data.frame")
and the code for my graph looks like this:
df%>%
ggplot(aes(x=days, y=emission))+
geom_point(color="darkblue", size=3.5) +
geom_errorbar(aes(ymin=emission, ymax=emission+se), width=.2,
position=position_dodge(0.05)) +
labs(color = "", size= "") +
labs(x = "Incubation time (days)", y = "Production (umol g-1 dw soil h-1)") +
theme_bw() +
facet_wrap(vars(compound), scales = "free_y")
---------------------------------UPDATE---------------------------------
I can see I did a terrible job trying to explain what I'm trying to do.
The data has a column called group. In this column the measurements are divided into a, b and c. I want to plot the average of each of these groups on top of the plot I've showed (where all measurements. There is only one measurement in a, so it does not make sense for this group. However for group b and c I wish to plot the average (and standard error) in the graph as well. These symbols would of course need to be different from what I've already plotted.
Also, I'm trying to change the color of the background behind each of the groups, to have different colors similar to this figure I found on google:





