g = g + stat_summary(fun.y = function(i) mean(i), If you don't want the box, just omit this step. In this case, I've chosen the average value. ![]() Next change the default theme: theme_set(theme_bw())Ĭonstruct a base object - nothing is plotted: g = ggplot(dd, aes(type, values))Īdd on the points: adjust the default jitter and change glyph according to type: g = g + geom_jitter(aes(pch=type), position=position_jitter(width=0.1))Īdd on the "box": calculate where the box ends. First load the ggplot2 package and generate some data: library(ggplot2)ĭd = ame(values=runif(21), type = c("Control", "Treated", "Treated + A")) The code below reproduces the plot that you are after pretty well - warning it is quite tricky. ![]() As mentioned, you can achieve this using ggplot2.
0 Comments
Leave a Reply. |