library(Hmisc); png ("~/Documents/R/R_tuto/plot5/test5.png", height = 1600, width = 1600, pointsize = 19); results <- read.table ("~/Documents/R/R_tuto/plot5/Table.txt", header = T); attach (results); par (mfrow = c(2,1), oma = c(1,4,6,4), mar = c(9.1,4.1,1.1,4.1)); barplot (Conserved, ylim = c(-1,1), main = "Bases", col = "yellow", axes = F); barplot (-Unconserved, ylim = c(-1,1), col = "yellow4", add=T, axes = F); axis (2, label = c(1, 0.5, "0.0", 0.5, 1), at = c(-1, -.5, 0, .5, 1)) axis (1, label = c("FB CDS","Cel. CDS","FB 5'UTR","Cel. 5'UTR","FB 3'UTR","Cel. 3'UTR","FB Exons","Cel. Exons","FB Introns","FB Pseudogenes","PolII binding sites","TF Sites","Histones","CNV","Origins"), las = 3, at = 0.7+1.2*(0:14), pos = -1.1) errbar (0.7+1.2*(0:14), Mean, yplus = (Mean + 2*SD), yminus = (Mean - 2*SD), add = T, pch = "") errbar (0.7+1.2*(0:14), -Mean2, yplus = -(Mean2 + 2*SD2), yminus = -(Mean2 - 2*SD2), add = T, pch = "") abline(h=0, lwd = 2) mtext("Fraction", side = 2, adj = 0.5, padj = -6) mtext("Conserved", side = 2, adj = 0.80, padj = -4) mtext("Unconserved", side = 2, adj = 0.2, padj = -4) barplot (Regions, ylim = c(-1,1), main = "Regions", col = "steelblue1", axes = F); barplot (-Unregion, ylim = c(-1,1), col = "steelblue4", add=T, axes = F); axis (2, label = c(1, 0.5, "0.0", 0.5, 1), at = c(-1, -.5, 0, .5, 1)) axis (1, label = c("FB CDS","Cel. CDS","FB 5'UTR","Cel. 5'UTR","FB 3'UTR","Cel. 3'UTR","FB Exons","Cel. Exons","FB Introns","FB Pseudogenes","PolII binding sites","TF Sites","Histones","CNV","Origins"), las = 3, at = 0.7+1.2*(0:14), pos = -1.1) errbar (0.7+1.2*(0:14), MeanR, yplus = (MeanR + 2*SDR), yminus = (MeanR - 2*SDR), add = T, pch = ""); errbar (0.7+1.2*(0:14), -MeanR2, yplus = -(MeanR2 + 2*SDR2), yminus = -(MeanR2 - 2*SDR2), add = T, pch = "") abline(h=0, lwd = 2) mtext("Fraction", side = 2, adj = 0.5, padj = -6) mtext("Conserved", side = 2, adj = 0.95, padj = -4) mtext("Unconserved", side = 2, adj = 0.3, padj = -4) detach (results); par(xpd=NA) mtext("Fraction of experimental annotation overlapping constrained vs unconstrained sequence", side = 4, adj = -0.3, padj = 5, outer = F, cex = 1.3); mtext("Drosophila melanogaster", side = 2, cex = 2, outer = TRUE, adj = 0, padj = -2, font = 3) #legend (14,1.5, c("Conserved Bases", "Conserved Regions", "Unconserved Bases", "Unconserved Regions"), fill = c("yellow","steelblue1","yellow3","steelblue3"), bty = "n", ncol = 2) mtext("Cel. = Celniker\nFB = Flybase", side = 3, outer = T, las = 3, cex = .75, adj = 0, padj = 22) dev.off();