Answers.Body: <p>You can add a color palette to the plot.</p>
  <p>e.g.</p>
  <pre class="lang-r prettyprint-override"><code>my_palette &lt;- colorRampPalette(c(&quot;red&quot;, &quot;orange&quot;, &quot;yellow&quot;,&quot;white&quot;))(n = 100);
  TOMplot(plotDiss, selectTree, selectColors, main =&quot;Network heatmap plot, selected genes&quot;, col=my_palette)
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-12-01T15:14:59.720Z
Answers.LastActivityDate: 2022-12-01T18:57:04.057Z
Answers.LastEditDate: 2022-12-01T18:57:04.057Z
Answers.UserDisplayName: CorteZero
Body: <p>I am trying to reproduce the results of the R tutorial of the WGCNA package.</p>
  <p>In section I number 5, when generating the heatmap it is quite similar to the one provided by the pdf but the colours of the heatmap differ from the document. Is it possible to change it?</p>
  <p>I attach the image together with the code used.</p>
  <p>[<img src="https://i.sstatic.net/hufTa.png" alt="image obtained" /></p>
  <p>Image Obtained</p>
  <p><a href="https://i.sstatic.net/zQR2m.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/zQR2m.png" alt="image of tutorial" /></a></p>
  <p>Image of tutorial</p>
  <pre class="lang-r prettyprint-override"><code>nSelect = 400
  set.seed(10);
  select = sample(nGenes, size = nSelect);
  selectTOM = dissTOM[select, select];
  selectTree = hclust(as.dist(selectTOM), method = &quot;average&quot;)
  selectColors = moduleColors[select];
  sizeGrWindow(9,9)
  plotDiss = selectTOM^7;
  diag(plotDiss) = NA;
  TOMplot(plotDiss, selectTree, selectColors, main = &quot;Network heatmap plot, selected genes&quot;)
  </code></pre>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-07-04T04:18:13.490Z
Comments.Text: Could you please provide a link to the WGCNA tutorial?
Comments.UserDisplayName: gringer
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-09-14T12:17:01.250Z
Comments.Text: Please consider the answer by @CorteZero - looks fine to me - and consider upvoting/accepting. Accepting an answer does help with site stats
Comments.UserDisplayName: M__
Tags: <rna-seq><wgcna>
Title: Tutorial for the WGCNA: changes in heatmap colours
ThreadText: # Tutorial for the WGCNA: changes in heatmap colours
  
  (Asked by: username_0 on 2022-07-02)
  
  I am trying to reproduce the results of the R tutorial of the WGCNA package.
  
  In section I number 5, when generating the heatmap it is quite similar to the one provided by the pdf but the colours of the heatmap differ from the document. Is it possible to change it?
  
  I attach the image together with the code used.
  
  [![image obtained](https://i.sstatic.net/hufTa.png)
  
  Image Obtained
  
  [![image of tutorial](https://i.sstatic.net/zQR2m.png)](https://i.sstatic.net/zQR2m.png)
  
  Image of tutorial
  
  ```r
  nSelect = 400
  set.seed(10);
  select = sample(nGenes, size = nSelect);
  selectTOM = dissTOM[select, select];
  selectTree = hclust(as.dist(selectTOM), method = "average")
  selectColors = moduleColors[select];
  sizeGrWindow(9,9)
  plotDiss = selectTOM^7;
  diag(plotDiss) = NA;
  TOMplot(plotDiss, selectTree, selectColors, main = "Network heatmap plot, selected genes")
  
  ```
  
  **Tags:** rna-seq, wgcna
  
  > **Comments:**
  > **username_1**: Could you please provide a link to the WGCNA tutorial?  
  > **username_2**: Please consider the answer by @username_3 - looks fine to me - and consider upvoting/accepting. Accepting an answer does help with site stats  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_3 on 2022-12-01. Score: 1
  
  You can add a color palette to the plot.
  
  e.g.
  
  ```r
  my_palette <- colorRampPalette(c("red", "orange", "yellow","white"))(n = 100);
  TOMplot(plotDiss, selectTree, selectColors, main ="Network heatmap plot, selected genes", col=my_palette)
  
  ```
  
  
  ---
  
  