1

I'm new to heatmap. I've data which looks like:

Dat       A        B        C        D        E
A    100       30.3      0       55.71    45.78
B     12.85   100       72.85    12.64    98.51
C      0       27.85   100       82.28     3.07
D     23.71    30.64    40.28   100        6.33
E     25.25    85       52.36    36.33   100

R code:

pdf("hh.pdf")
library(gplots)
data = read.table("file.txt", header=T, row.names=1)
heatmap.2(as.matrix(data))
dev.off()

When I plot heatmap with above data, it is Okay, with those grid lines. But when I get row count as 100 or in that range, plot is barely visible. Plot is covered with dash-dash vertical lines.
I want to get rid of those annoying lines. I've saved in .png format, but again, I get same lines.

I have checked heatmap.2 (gplots package) - how to remove annoying lines in some cells?

Using R 3.0.2

Community
  • 1
  • 1
Death Metal
  • 830
  • 3
  • 9
  • 26
  • 1
    @bluefeet : Well, I agree that it was kind of a lame question, but the referenced question and answer was NOT a duplicate. – IRTFM Aug 12 '14 at 03:22
  • 1
    Wow! That was unsuspected behavior. Apparently I have the authority reopen questions with one vote. – IRTFM Aug 12 '14 at 03:25
  • 1
    @BondedDust The user posted an answer [below](http://stackoverflow.com/a/25253809/426671) with a link to another SO question stating "Got it". That points out that this is a duplicate which was why I closed it. – Taryn Aug 12 '14 at 10:28
  • 1
    Right, but neither of the answers mentioned `trace` or `tracecol` which were the parameters that controlled the "gridlines that were the nub of the question. The other answers involved color palettes. – IRTFM Aug 12 '14 at 14:22

3 Answers3

5
 pdf("hh.pdf")
 library(gplots)
 data = read.table(text="Dat       A        B        C        D        E
 A    100       30.3      0       55.71    45.78
 B     12.85   100       72.85    12.64    98.51
 C      0       27.85   100       82.28     3.07
 D     23.71    30.64    40.28   100        6.33
 E     25.25    85       52.36    36.33   100", header=T, row.names=1)

 heatmap.2(as.matrix(data), tracecol=NA)
IRTFM
  • 258,963
  • 21
  • 364
  • 487
2

I would suggest also to use the package "pheatmap" as follows:

pheatmap(as.matrix(data)).

It is much more powerful than ggplots heatmap.2.

0

Got it:

pdf("test.pdf")
data = read.table("srg.txt", header=T, row.names=1) 
heatmap.2(as.matrix(data), dendrogram=c("row"),density.info="none", trace="none",symm=T)
dev.off()

How to change heatmap.2 color range in R?

Community
  • 1
  • 1
Death Metal
  • 830
  • 3
  • 9
  • 26