Question: how do you remove the trace in heatmap.2 in R?
1
gravatar for RNAseqer
17 months ago by
RNAseqer 140
RNAseqer 140 wrote:

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 microarray heat map R • 2.1k views
ADD COMMENTlink modified 17 months ago by Kevin Blighe65k • written 17 months ago by RNAseqer 140
1

haha, hideous is right

ADD REPLYlink written 17 months ago by russhh5.5k
4
gravatar for Kevin Blighe
17 months ago by
Kevin Blighe65k
Kevin Blighe65k wrote:

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 COMMENTlink written 17 months ago by Kevin Blighe65k
1

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 REPLYlink written 17 months ago by RNAseqer 140
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 922 users visited in the last hour