library(plotrix)

a <- read.table('projected_1.dat')*10
b <- read.table('projected_2.dat')*10

xlim=c(-2,12); ylim=c(-2, 8.5);

pdf('projections.pdf', w=7, h=3.5)
par(mfcol=c(1,2), mar=c(3,3,1,1), mgp=c(1.4,0.5,0))


rgb.palette <- colorRampPalette(c("grey50", "white"),
                                space = "rgb")
cols <- densCols(a[-c(2,3),1:2], colramp=rgb.palette)
plot(a[-c(2,3),1:2], type='p', col=cols, pch=16, cex=0.5,
     xlab="Displacement (Å)", ylab="Displacement (Å)", 
     xlim=xlim, ylim=ylim, cex.axis=0.75, cex.lab=0.8)
points(a[1,1:2], col='red', pch=16, cex=.8)
points(a[1,1:2], col='black', pch=1, cex=.9, lwd=1.2)

points(a[2,1:2], col='blue', pch=16, cex=0.8)
points(a[2,1:2], col='black', pch=1, cex=.9, lwd=1.2)
abline(v=0, col="grey50", lty=2)
abline(h=0, col="grey50", lty=2)




rgb.palette <- colorRampPalette(c("grey50", "white"),
                                space = "rgb")
cols <- densCols(b[-c(2,3),1:2], colramp=rgb.palette)

plot(b[-c(2,3),1:2], type='p', col=cols, pch=16, cex=0.5,
     xlab="Displacement (Å)", ylab="Displacement (Å)", 
     xlim=xlim, ylim=ylim, cex.axis=0.75, cex.lab=0.8)
points(a[1,1:2], col='red', pch=16, cex=.8)
points(a[1,1:2], col='black', pch=1, cex=.9, lwd=1.2)

points(a[2,1:2], col='blue', pch=16, cex=0.8)
points(a[2,1:2], col='black', pch=1, cex=.9, lwd=1.2)

abline(v=0, col="grey50", lty=2)
abline(h=0, col="grey50", lty=2)

dev.off()
