#X axis is Prepost
#Y axis is "value" (participants scores on memory or life satisfaction at pre- or posttest)
#group/colour = separate lines for Memory and Life Satisfaction

library(ggplot2)
library(HMisc)

ggplot(dlong3, aes(x=Prepost, y=value, colour=Task,
group=Task)) +
stat_summary(fun = mean,
geom = "point") + #Plots the mean in each condition
stat_summary(fun.data = mean_cl_normal,
geom = "errorbar",width=0.2, fun.args=list(mult=1.96),size=1) + #95% confidence interval
geom_smooth(method='lm', formula= y~x, size=1,se=FALSE)+ #line connecting occasions for each group
labs(title = "Prepost change in ZLifeSat and ZMemory (correct)",
x= "Occasion (Pretest, Posttest)",
y="Task Z Score (correct)") +
theme_bw() + #Removes background grey
theme(text=element_text(size=10)) #Controls font size

#in stat_summary, width = horizontal width of bars
#in geom_smooth, size = line thickness