d1 <- read.table("all_cum3")
d2 <- read.table("all_cum6")
d3 <- read.table("all_cum12")
d4 <- read.table("all_cum20")
d5 <- read.table("all_cum50")

pdf("cumulative_overlaps.pdf", onefile=TRUE)
par(mfrow=c(1,1))

print(d1)

plot(d1[,1], d1[,2], type='o', xlab="Window number", ylab="Cumulative Squared Overlap", main="Cumulative values for different windows", ylim=c(0,1))
lines(sort(d2[,1]), d2[,2], col=2, type='o')
lines(sort(d3[,1]), d3[,2], col=3, type='o')
lines(sort(d4[,1]), d4[,2], col=4, type='o')
lines(sort(d5[,1]), d5[,2], col=5, type='o')

#plot(time[,1], table1[,1], type="o", xlab="Time (ps)", ylab="Energy (kcal/mole)", main="Potential Energy during MD simulation of 256 Argon atoms")
#plot(time[,1], table1[,1], type="l", xlab="Time (ps)", ylab="Pressure", main="Pressure during MD simulation of 256 Argon atoms")

#plot(table1[,1], type="o", xlab="Time (every 100 timestep)", ylab="Energy (kcal/mole)", main="Energies during MD simulation of 256 Argon atoms", ylim=c(-520, -400))
#lines(table2[,1], col=2, type="l")

legend(60,0.3, c("Cum 3", "Cum 6", "Cum 12", "Cum 20", "Cum 50"), col=c(1,2,3,4,5), lty=c(1,1,1,1,1))

dev.off()
graphics.off()
