library(ggplot2)
 
library(gridExtra)
h<-read.table("/Volumes/Volume_4/analysis/ee-dsim-pele/analysis/2016-05-invasion-plots/data/hot-r1.txt",header=T)
# convert chromosome to ordered factor
 
h$chromosome <- factor(h$chromosome, levels=c("X", "2L", "2R", "3L", "3R", "4"))
 
g20<-h[h$generation==20,]
 
pl<- ggplot(h,aes(x=position))+geom_histogram(binwidth = 500000)+facet_grid(generation~chromosome, scales="free_x", space = "free_x")
 
plot(pl)