##create histogram data <- read.table("SNP_Fst_Freq.csv", header=TRUE, sep=',') Fst <- data$Fst bins <- seq(-0.1,0.7,by=0.05) scores <- cut(Fst,bins) transform(table(scores)) ##increase the size of the top margin and plot data par(mar = c(5, 4, 6, 2), lwd=1.5) with(data,hist(Fst[Fst >=-0.1 & Fst <0.7], breaks=seq(-0.1,0.7,by=0.05), main='', xlab="", ylab="", axes=F, col='gray')) ##create your own axes so that you can position them manually and make them touch ##change the length and width of axes and tick marks axis(1, seq(from=-0.1, to=0.7, by=0.1), seq(from=-0.1, to=0.7, by=0.1), pos=0, xpd=TRUE, lwd=1.5) axis(2, seq(from=0, to=800, by=200), seq(from=0, to=800, by= 200), pos=-0.1, xpd=TRUE, las=1, lwd=1.5) ##add axis titles (removed from initial histrogram code because they were too far away from plot) that you can position closer to axis mtext(text = expression(italic(F)[ST]), side=1, line=2, cex=1.1) mtext(text = "Frequency", side=2, line=2, at=400, cex=1.1) ##add arrows and labels to show FST values of color traits arrows(0.320, 225, 0.320, 25, length=0.1) arrows(0.611, 225, 0.611, 25, length=0.1) arrows(0.202, 371, 0.202, 171, length=0.1) arrows(0.143, 595, 0.143, 354, length=0.1) text(0.320, 252, 'Crossbands', cex=1) text(0.611, 250, 'Stripe', cex=1) text(0.611, 299, 'Red', cex=1) text(0.202, 396, 'Cap', cex=1) text(0.202, 445, 'Black', cex=1) text(0.143, 620, 'Band', cex=1) mtext(text="Nuchal", side=3, line=0, at=0.143) mtext('B', side=3, cex=1.4, font=2, line=3, at=-0.25)