how do you remove the trace in heatmap.2 in R?
1
1
Entering edit mode
5.0 years ago
RNAseqer ▴ 260

Im using the heatmap.2 function in R to create a clustered heatmap of some microarray data. My commands are written as this:

  heatmap.2 (as.matrix(highly_variable_genes,col=rev(morecols(50)),trace="none", main="Top 500 most variable genes across samples",ColSideColors=col.cell,scale="row"))

But even though I have specified that I don't want that hideous cyan squiggly 'trace' over my cells, which obscures everything, it keeps coming up. I've tried re-writing the command a few different ways and cannot get rid of it. Does anyone see what I have done wrong?

This command is taken wholesale from a tutorial that has no trace over its heatmap cells so I really dont know whats going on here...unless the commands have been updated in R.

Many thanks for your help.

heatmap.2 r microarray heat map • 7.4k views
ADD COMMENT
1
Entering edit mode

haha, hideous is right

ADD REPLY
4
Entering edit mode
5.0 years ago

I agree that the tracing leaves much to be desired and I have never used it.

There is something peculiar about the way you have written your code - take a closer look at it. You are passing all of the following to as.matrix(), which fails to issue any warning: x,col=rev(morecols(50)),trace="none", main="Top 500 most variable genes across samples",,scale="row"

Here is a simple solution:

require(gplots)

generate random data

x <- matrix(rexp(200, rate=.1), ncol=20)

reproduce the 'bug' with trace lines

heatmap.2(as.matrix(x,col=rev(morecols(50)), trace="none", main="Top 500 most variable genes across samples",,scale="row"))

g

get rid of trace lines

heatmap.2(as.matrix(x), trace="none", main="Top 500 most variable genes across samples", scale="row")

b

ADD COMMENT
1
Entering edit mode

Those commands for the random dataset certainly work. It must be a bug in my code, I'll look at it again and redo the whole thing. Thanks for the fix!

ADD REPLY

Login before adding your answer.

Traffic: 1895 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6