The data are in "stats":
run valence mean sd sem
Nnf1_mINS n 2.1 .5 .01
Nnf2_mINS p 3.2 .2 .01
Nobs_mINS n 2.3 .1 .02
Here's my code:
ggplot(stats,aes(x=run,y=mean,color=valence,group=1))+
geom_point() +
geom_line()+
geom_errorbar(aes(ymin = mean - sem, ymax = mean + sem),
width = 0.2,
position = position_dodge(0.9))
3 problems:
- to specify the order on x axis, I turned the variable into a factor:
stats$run <- factor(stats$run, levels = c("Nobs_mINS","Nnf1_mINS","Nnf2_mINS"))
but to plot 2 lines on one plot, there can't be a factor variable. This is the error: "geom_path: Each group consists of only one observation. Do you need to adjust the group aesthetic?" I fixed this error by adding "group=1" thanks to this post: ggplot2 line chart gives "geom_path: Each group consist of only one observation. Do you need to adjust the group aesthetic?"