I'm analysing a dataset where the temperature of 2 fingers on both hands has been measured for half an hour. I would like to make a line plot, with means and errorbars based on whether the hand received active treatment or not and which finger. Which means that the curves must be distiunguished by two variables and with x being time and y being temperature.
I have tried making it from the full dataset, however, did not come up with anything meaningfull. Then I have tried, where I seperate the dataset into two based on active or placebo treatment and then combine them again in the plot, but some of the lines does not cumpute with the aesthestics I have set.
I have tried the following webpage, however, with no luck: http://www.cookbook-r.com/Graphs/Plotting_means_and_error_bars_(ggplot2)/
Any ideas? Thank you!
plot10 <- ggplot(data3, aes(x=time, y=temp, colour=finger, group=finger))+
geom_errorbar(aes(ymin=temp-ci, ymax=temp+ci),colour="black", width=1, position=pd)+
geom_line(position=pd, size=1)+
geom_point(position=pd, size=3, shape=21, fill="white")+
geom_line(data=data4, aes(x=time, y=temp, colour=finger, group=finger))+
geom_errorbar(aes(ymin=temp-ci, ymax=temp+ci),colour="black", width=1, position=pd)+
geom_line(position=pd, size=1)+
geom_point(position=pd, size=3, shape=21, fill="white")+
theme_bw()
Plot from above code: