The legend for d2 looks fine; for d1, I would like to show just the hoizontal line against a white/transparent backgounnd.
df = dat
# Bar graph: Notice the placement of fill argument in aes()
geom_bar(aes(y=prop.P*100, fill="Seropositive"), stat = "identity",
position = "dodge", width = 0.5)+
# This line defines the legend for the bar
scale_fill_manual(name="", values = c("Seropositive"="steelblue3"))+
# Adding errorbar
geom_errorbar(aes(ymin = ciLow*100, ymax = ciHigh*100), width = 0.2,
position = position_dodge(width=0.8))+
# Adding the line to the graph. Used the color argument within aes() to define custom colour
geom_line(aes(y=mmr1_cov*100, group=1, color="MMR1 Coverage"), size=1)+
# Adding points represent the plotted data
geom_point(aes(x=age, y=mmr1_cov*100), color="red", size=2)+
# Here adding the legend for the line graph and define the colour
scale_color_manual(name="", values=c("MMR1 Coverage"="red"))+
# Label the axis
labs(x="Age (Months)", y="Percentage")+
# Place the legend bottom of the graph
theme(legend.position = "bottom")
Section of the graph displaying the results