![]() ![]() Theme_bw() One line graph overlaid on another line graph Labs(color="Group ID", x="Day", y = "Mean Fasting Blood Glucose (mg/dl)") + Geom_errorbar(aes(ymin = ci95lower, ymax = ci95upper), width = 0.5) + Geom_line(aes(x=timedays, y=bloodglc2, group=patientn, color=" Group 2 Patients"), data=glcdata3) + Geom_line(aes(x=timedays, y=bloodglc2, group=patientn, color=" Group 1 Patients"), data=glcdata3) + Ggplot(statsBG, aes(x=timedays, y=meanBG, color=groupid, shape=groupid)) + #Mean profile and errorbars overlaid on the individual profiles Labs(x="Day", y = "Mean Fasting Blood Glucose (mg/dl)") + ![]() Geom_point() + facet_wrap(~groupid, nrow = 1) + Ggplot(statsBG, aes(x=timedays, y=meanBG)) + The facet_wrap() and the specified arguments creates two separate graphs (for the two groups: ~groupid ) side-by-side (based on the argument nrow=1) in two separate panels on a single row. We did not specify what symbol should be used so the default (dot) is used. Geom_line() connects the lines from one day to another, and geom_point() places a symbol at each point plotted in the graph. We use the functions geom_line() and geom_point() to plot the mean values calculated above. Let’s visualize the mean blood glucose per day for each group in a separate graph. The summarise() function was used to calculate number of data points, mean, standard error, standard deviation and the 95% confidence interval, per timepoint and for each group.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |