Reputation: 5
I have made a ggplot of the insulin conc. at different timepoints (OGTT) for two different treatments. Afterwards I have added points showing the mean values:
p<-ggplot(data=data2, aes(x = factor(OGTT), y = Insulin, group = StudyID, color=StudyID)) +
geom_line() +
facet_grid(End.start ~Treatment)+
stat_summary(aes(group = Treatment), geom = "point", fun.y = mean, shape = 16, size = 2)
My questions are:
Upvotes: 0
Views: 85
Reputation: 1364
The ggplot2 cookbook has answers for most fairly basic questions like this.
To add error bars, calculate the upper and lower values of the error bars separately. Then plot using geom_errorbar()
.
http://www.cookbook-r.com/Graphs/Plotting_means_and_error_bars_(ggplot2)/
To remove all legends use
theme(legend.position="none")
For more control, there are a number of other options.
http://www.cookbook-r.com/Graphs/Legends_(ggplot2)/
Upvotes: 1