Dear R users, I am trying to print heatmaps in a loop (with a pause). Idea is to visualize changing correlations over time and for testing I wrote this simple (reproducible) code below. My problem is that levelplot() does not produce any output when I run the code (though heatmap does). Ideally I would like to use levelplot() as it produces a neat index on the side indicating the color and the correlation value that it corresponds to while heatmap does not. Any pointers as to how I can make levelplot() produce output in the loop or get heatmap to procude a nice index like levelplot() does? ps- To see the output with heatmap in a loop, just uncomment the heatmap() line and comment out the levelplot() line
col.l <- colorRampPalette(c('blue', 'green', 'yellow', 'red'))(30) for (i in 1:10) { randmat <- cbind(rnorm(100),rnorm(100),rnorm(100),rnorm(100),rnorm(100)) colnames(randmat) <- c('A','B','C','D','E') cormat <- cor(randmat) levelplot(cormat,xlab=NULL,ylab=NULL,main='Correlation Heat Map',col.regions=col.l) # heatmap(cormat,col=col.l,Rowv=NA, Colv=NA,main=paste("Plot:",i,sep='')) Sys.sleep(1) } Thanks much in advance! [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.