## See example RScript below. It has been annotated for clarity. ## Please feel free to modify this as needed. Note that the ggplot2 ## and ggsignif are two separate packages that must be added to your ## library for this script to run. #### Load packages and example dataset #### library(ggplot2) library(tidyverse) library(ggsignif) J774A.1.Area <- read.csv(file = 'Cell Surface Area.csv') #### Perform an ANOVA and post-hoc test. #### Area.ANOVA <- aov(Cell.A ~ Treatment.A, data = J774A.1.Area) summary(Area.ANOVA) TukeyHSD(Area.ANOVA) # Print your data. ## diff lwr upr p adj ##Mock (MeOH)-Mock (1x PBS only) -18.3315 -228.97271 192.30971 0.9992534 ##LPS (500 ng/mL)-Mock (1x PBS only) 430.7079 220.06669 641.34911 0.0000008 ##Nigericin (45 mins)-Mock (1x PBS only) 820.6452 610.00396 1031.28638 0.0000000 ##Nigericin (2 hr)-Mock (1x PBS only) 593.4385 380.98915 805.88780 0.0000000 ##LPS (500 ng/mL)-Mock (MeOH) 449.0394 238.39819 659.68061 0.0000003 ##Nigericin (45 mins)-Mock (MeOH) 838.9767 628.33546 1049.61788 0.0000000 ##Nigericin (2 hr)-Mock (MeOH) 611.7700 399.32065 824.21930 0.0000000 ##Nigericin (45 mins)-LPS (500 ng/mL) 389.9373 179.29606 600.57848 0.0000097 ##Nigericin (2 hr)-LPS (500 ng/mL) 162.7306 -49.71875 375.17990 0.2189068 ##Nigericin (2 hr)-Nigericin (45 mins) -227.2067 -439.65602 -14.75737 0.0296109 #### Set parameters for class and factor #### ## This will make sure your conditions show up in the desired order when ##graphing. It will otherwise sort according to alphabetical order. class(J774A.1.Area$Treatment.A)3 J774A.1.Area$Treatment.A = factor(J774A.1.Area$Treatment.A, level = c('Mock (1x PBS only)','Mock (MeOH)', 'LPS (500 ng/mL)','Nigericin (45 mins)','Nigericin (2 hr)')) levels(J774A.1.Area$Treatment.A) class J774A.1.Area$Treatment.A <- as.factor(J774A.1.Area$Treatment.A, levels = c('Mock (1x PBS only)','Mock (MeOH)', 'LPS (500 ng/mL)','Nigericin (45 mins)','Nigericin (2 hr)')) head(J774A.1.Area) level_order_area <- c('Mock (1x PBS only)','Mock (MeOH)', 'LPS (500 ng/mL)','Nigericin (45 mins)','Nigericin (2 hr)') #### Set parameters for the plot you want to create. #### ## The following script will generate boxplots with a dot-plot overlaid. CellAreaPlot <- ggplot(J774A.1.Area, aes(x=factor(Treatment.A, level=level_order_area), y=Cell.A,fill=Treatment.A)) + geom_boxplot(outlier.colour="red", outlier.shape=16, outlier.size=2.5, notch=FALSE, outlier.alpha = 0.1) + labs(y = bquote('Cell surface area'~(μm^2)), x = "Treatment group") + scale_fill_manual(values = c("#FAE6FA","#D8BFD8","#B768A2","#6C3082","#301934")) + theme(legend.position="none") + geom_dotplot(binaxis='y', stackdir='center', dotsize=0.3, stackratio=1.5) CellAreaPlot # Print your plot; check for any errors. CellAreaPlot # If you want, annotate your plot to indicate the significance of your measurements. CellAreaPlot + geom_signif(y_position = c(750,1450,1950, 2070, 2250), xmin = c(1,1,3, 4,3), xmax = c(2,3,4,5,5), annotation = c("ns","***","***","**","ns"), tip_length = 0.01)