# graphPad

[http://www.sthda.com/english/wiki/ggplot2-barplots-quick-start-guide-r-software-and-data-visualization](http://www.sthda.com/english/wiki/ggplot2-barplots-quick-start-guide-r-software-and-data-visualization)

library(ggplot2)\
\#Basic barplot\
p<-ggplot(data=df, aes(x=dose, y=len)) + geom\_bar(stat="identity")&#x20;

\#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()&#x20;

\+ 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)



[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](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"))
