I am trying to make a hatch plot in ggplot with 2 values ββfor each bin (dump the change values ββfrom RNA-Seq and qPCR experiments):
Gene FC expt se a 1.02 RNA-Seq 0 b 2.79 RNA-Seq 0 c 1.63 RNA-Seq 0 d 0.84 RNA-Seq 0 e 0.81 RNA-Seq 0 f 1.45 RNA-Seq 0 g 1.27 RNA-Seq 0 h 1.72 RNA-Seq 0 i 2.52 RNA-Seq 0 a 0.84 qPCR 0.16 b 1.92 qPCR 0.15 c 1.14 qPCR 0.78 d 0.47 qPCR 0.76 e 0.95 qPCR 0.26 f 0.32 qPCR 0.51 g 0.92 qPCR 0.39 h 0.97 qPCR 0.61 i 1.73 qPCR 0.77
My RNA-Seq values ββdo not have error bars. As such, I want to build a tablet with:
- Error bars that expand
- Error bars for q-PCR columns only
I'm not sure if my code (or input format) is going wrong:
df <- read.table("stack.txt", header=TRUE) limits <- aes(ymax = FC + se, ymin = FC) dodge <- position_dodge(width = 0.9) ggplot(data=df, aes(x=Gene, y=FC)) + geom_errorbar(limits, position = dodge, width = 0.25) + geom_bar(aes(fill=expt),colour="black", stat="identity", position = dodge)
What produces:

As you can see, error bars are in the middle of each bin, and not on each bar. Any suggestions and comments would be greatly appreciated!
source share