<p>You have <code>scale="col"</code> in the code. What you are plotting is the z-score calculated based on the value distribution per column. Try changing it to <code>"row"</code> or <code>"none"</code>.</p>

CC BY-SA 3.0
2017-10-25T15:51:57.207Z
2017-10-25T15:58:50.637Z
2017-10-25T15:58:50.637Z
Kraken
<p>I am learning about generating heatmaps using R. For this example I am using randomly generated data to test the process, but I encountered what appears to be an error or perhaps there is something am missing. Specifically, the values of Npy2r in groups A &amp; B are the same, yet the heat map colors them differently. I am trying to understand why. Am including the R code I am using to generate the heat map<a href="https://i.sstatic.net/F9ToQ.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/F9ToQ.png" alt="heatmap"></a></p>

<pre><code>heatmap.2(x, Rowv=F, Colv = F, scale="col", col=greenred(3), key=TRUE, symkey=FALSE,                             
      density.info="none",cexRow=1,cexCol=1,margins=c(6,11),  trace="none",srtCol=45)
</code></pre>

<r><differential-expression><microarray>
error in heatmap using R
# error in heatmap using R

(Asked by: username_0 on 2017-10-25)

I am learning about generating heatmaps using R. For this example I am using randomly generated data to test the process, but I encountered what appears to be an error or perhaps there is something am missing. Specifically, the values of Npy2r in groups A & B are the same, yet the heat map colors them differently. I am trying to understand why. Am including the R code I am using to generate the heat map
heatmap.2(x, Rowv=F, Colv = F, scale="col", col=greenred(3), key=TRUE, symkey=FALSE,                             
      density.info="none",cexRow=1,cexCol=1,margins=c(6,11),  trace="none",srtCol=45)

**Tags:** r, differential-expression, microarray

---

## 1 answers

### Answer by username_1 on 2017-10-25. Score: 8

You have `scale="col"` in the code. What you are plotting is the z-score calculated based on the value distribution per column. Try changing it to `"row"` or `"none"`.


---

