I have 10 different trials (with each their own data set). I have already found the predicted values that was taken from model and created a new column with the prediction values.
I bounded all the x, y, and the predicted.y values for each trial into one dataframe by rbind()
I want to plot the mean of all the y values with the same x values (of the predicted values) and also plot the confidence interval using the geom_ribbon rather than the error bars.
I have already referred to this link: plotting the means with confidence intervals with ggplot, however, when I plot the stat_summary(geom="ribbon", fun.data=mean_cl_normal, fun.args=list(conf.int=0.95), fill="lightblue")
the ggplot does not plot anything but it also does not come out with any errors so I'm not sure what went wrong.
Is there another way to have the same result with different code? Or is there a problem with the way I bounded my values and dataset?
MORE INFO
This is the combined data
y<dbl> x<dbl> predy<dbl>
0.300 83.69 0.3292044030
0.312 83.69 0.3291121879
0.324 83.69 0.3291012056
0.330 83.69 0.3287549029
0.330 83.61 0.3291187262
0.335 83.57 0.3293862893
0.334 83.36 0.3303592465
0.329 82.79 0.3328754639
0.324 82.55 0.3339801283
0.323 82.92 0.3319657277
When I used the code:
ggplot(ASframe, aes(x=x, y=y))+
stat_summary(geom="ribbon", fun.data=mean_cl_normal, fun.args=list(conf.int=0.95), fill="lightblue")+
stat_summary(geom = "line", fun = mean, linetype = "dashed")+
stat_summary(geom = "point", fun=mean, color= "red", alpha = I(0.5)) +
ylim(-0.1, 0.6)
The results came out to be: