2
$\begingroup$

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

Image Obtained

image of tutorial

Image of tutorial

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")
$\endgroup$
2
  • $\begingroup$ Could you please provide a link to the WGCNA tutorial? $\endgroup$
    – gringer
    Jul 4, 2022 at 4:18
  • $\begingroup$ Please consider the answer by @CorteZero - looks fine to me - and consider upvoting/accepting. Accepting an answer does help with site stats $\endgroup$
    – M__
    Sep 14, 2023 at 12:17

1 Answer 1

1
$\begingroup$

You can add a color palette to the plot.

e.g.

my_palette <- colorRampPalette(c("red", "orange", "yellow","white"))(n = 100);
TOMplot(plotDiss, selectTree, selectColors, main ="Network heatmap plot, selected genes", col=my_palette)
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.