graphPad
library(ggplot2) #Basic barplot p<-ggplot(data=df, aes(x=dose, y=len)) + geom_bar(stat="identity")
#Horizontal bar plot p + coord_flip()
pbasic <- ggplot(data=basic, aes(x=group, y=mean_sc)) + geom_bar(stat="identity", width=0.5, color="blue", fill="white") + theme_minimal()
+ scale_x_discrete(limits=c("colA", "colC"))
+ geom_text(aes(label=len), vjust=-0.3, size=3.5) outside bar
+ geom_text(aes(label=len), vjust=1.6, color="white", size=3.5) inside bar
ANOVA
http://www.sthda.com/english/wiki/one-way-anova-test-in-r
http://www.sthda.com/english/wiki/one-way-anova-test-in-r
https://cran.r-project.org/web/packages/ggsignif/vignettes/intro.html
dat <- data.frame(Group = c("S1", "S1", "S2", "S2"), Sub = c("A", "B", "A", "B"), Value = c(3,5,7,8))
ggplot(dat, aes(Group, Value)) + geom_bar(aes(fill = Sub), stat="identity", position="dodge", width=.5) + geom_signif(stat="identity", data=data.frame(x=c(0.875, 1.875), xend=c(1.125, 2.125), y=c(5.8, 8.5), annotation=c("", "NS")), aes(x=x,xend=xend, y=y, yend=y, annotation=annotation)) + geom_signif(comparisons=list(c("S1", "S2")), annotations="*", y_position = 9.3, tip_length = 0, vjust=0.4) + scale_fill_manual(values = c("grey80", "grey20"))
Last updated