

plot.corrmat <- function(mat, sse=NULL,

                         helix.labels.x=NULL,
                         helix.labels.at.x=NULL,
                         helix.labels.y=NULL,
                         helix.labels.at.y=NULL,
                         
                         axis.at.x=NULL, axis.at.y=NULL,
                         axis.labels.x=NULL, axis.labels.y=NULL,
                         cex.axis=.7, cex.sse=.6,
                         
                         vlines=NULL, hlines=NULL,
                         xlab = "Residue index",
                         ylab = "Residue index",
                         main = "",
                         levels = pretty( c(-1,1), 20),
                         
                         Labpalette = colorRampPalette(c("blue", "white", "red"),
                           space = "Lab"),
                         ...) {

  nr <- dim(mat)[1]
  nc <- dim(mat)[2]

  filled.contour( x=1:nr, y=1:nc, z=mat, color = Labpalette,
                 levels = levels,
                 nlevels = 10,
                 xlab = xlab, ylab=ylab, main = main,

                 plot.axes={
                   axis(2, at=axis.at.y, labels=axis.labels.y, cex.axis=cex.axis);
                   axis(1, at=axis.at.x, labels=axis.labels.x, cex.axis=cex.axis);


                   abline(v=axis.at.x, lty=2, col="grey70");
                   abline(h=axis.at.y, lty=2, col="grey70");
                   
                   mtext(helix.labels.y, side=4, line=0.2, las=2,
                         at=helix.labels.at.y,
                         cex=cex.sse);
                    mtext(helix.labels.x, side=1, line=0.5, las=2,
                         at=helix.labels.at.x,
                         cex=cex.sse);

                   abline(v=vlines); abline(h=hlines);
                   mtext(c("E1", "I1", "A", "I2", "E2"),
                         at=c(132/2, (132+190)/2, (190+376)/2, (376+408)/2, (408+524)/2),
                         side=3, line=0.7, cex=1.1);


                 },
                 ...
                 )
}
