Hi All We are using R to spit out plots(heatmaps) which are being rendered on a shiny app (web page). Currently we are facing an issue with the time it takes R to render a plot taking out the time it takes to do the computation. Let me show the same through a contrived example. In this basic test case R takes ~17 seconds to render and save a heatmap file as png (data computer time is taken out : row and cols clusters are precomputed)
I am wondering is there a way to reduce the time it takes to render this plot type by a significant factor. Maybe I am missing on some other constant computation which can be also taken out of the heatmap function. PS: cross posted on stackoverflow http://stackoverflow.com/questions/20149107/how-to-make-r-render-plots-faster Thanks! -Abhi **generate data** m1 <- matrix(rnorm(500000,mean=15,sd=4),ncol=100) m2 <- matrix(rnorm(500000,mean=30,sd=3),ncol=100) m <- cbind(m1,m2) dim(m) **basic heat map with all computation** png('test_heatmap.png') system.time(heatmap(m)) user system elapsed 29.327 0.637 30.526 **do the clustering out of heatmap function : mainly to test the plot rendering time** > system.time(hcr <- hclust(dist(m))) user system elapsed 9.992 0.126 10.144 > system.time(hcc <- hclust(dist(t(m)))) user system elapsed 0.659 0.002 0.662 > system.time(ddr <- as.dendrogram(hcr)) user system elapsed 0.498 0.010 0.508 > system.time(ddc <- as.dendrogram(hcc)) user system elapsed 0.011 0.000 0.011 **heatmap rendering time with pre-computed row/col dendogram** png('test_heatmap.png') > system.time(heatmap(m,Rowv=ddr,Colv=ddc)) user system elapsed 16.128 0.558 17.171 ______________________________________________ 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.