[R] Saving heatmaps as PDFs
dorothyc
dorothyc at bcgsc.ca
Tue Aug 25 01:04:08 CEST 2009
Hi,
I'm trying to save heatmaps as PDFs. However, the PDF version of the
heatmaps (Heatmap_CAFvsTNF_run2.pdf) is blurred when compared to its
counterpart, which was saved manually by using the software
"Grab" (Heatmap_CAFvsTNF_run2.tiff).
-----R code--------
sample_output <- "stroma_run2"
filename <- "exp_limma_results_final_probesets_Pbelowpoint05.txt"
# read in data
my.data <- read.delim(filename, sep="\t")
my.dataM <-my.data[,2:ncol(my.data)]
hr <- hclust(as.dist(1-cor(t(my.dataM), method="pearson")),
method="complete")
hc <- hclust(as.dist(1-cor(my.dataM, method="spearman")),
method="complete")
# generate heat map
library(gplots)
if (is.null(sample_output)) {
pdf( "Heatmap.pdf")
} else {
pdf(file=paste("Heatmap_", sample_output, ".pdf", sep="")) }
heatmap.2(as.matrix(my.dataM),Rowv=as.dendrogram(hr),
Colv=as.dendrogram(hc),cexRow=0.01,
cexCol=0.8, dendrogram="none", col=greenred(100),
scale="row",key=TRUE, trace="none",density.info="none",
symkey=FALSE, main=paste("Heatmap_", sample_output))
dev.off()
--------------
Thanks,
Dorothy
More information about the R-help
mailing list