Git Product home page Git Product logo

Comments (1)

guidohooiveld avatar guidohooiveld commented on August 16, 2024 1

Yep, I agree that in heatmaps positive values are usually assigned red, and negative values blue.

As you likely will know, since September the default colors have been changed:
(2023-09-13, Wed): change default color: from c("red", "blue") to c("#e06663", "#327eba")

Somehow this change apparently also resulted in reversing the order of the Fold Change in the legend of the heatplot (i.e. negative values [-2] are now at the top, positive values [4] at the bottom). This is opposite on how it used to be... For that see e.g. Fig 15.6 here: https://yulab-smu.top/biomedical-knowledge-mining-book/enrichplot.html#heatmap-like-functional-classification

Heatplot-1
Fig 15.6.

@huerqiang ; @GuangchuangYu : would you mind having a look at this? So that by default negative values in the heatplot are blue, and positive values red again? So the old behavior is restored?

For now a quick fix for the heatplot colors could be that manually the colors are reversed before generating the heatplot:
options(enrichplot.colours = c("#327eba","#e06663")) ##these are the new colors


> library(DOSE)
> library(enrichplot)
> 
> data(geneList)
> de <- names(geneList)[abs(geneList) > 2]
> edo <- enrichDGN(de)
> ## convert gene ID to Symbol
> edox <- setReadable(edo, 'org.Hs.eg.db', 'ENTREZID')
> 
> 
> ## using the new default pastel colors
> p1 <- heatplot(edox, showCategory=5)
> p2 <- heatplot(edox, foldChange=geneList, showCategory=5)
> cowplot::plot_grid(p1, p2, ncol=1, labels=LETTERS[1:2])
> 
> 

image

> ## apply fix; reverse colors
> options(enrichplot.colours = c("#327eba","#e06663")) 
> p3 <- heatplot(edox, showCategory=5)
> p4 <- heatplot(edox, foldChange=geneList, showCategory=5)
> cowplot::plot_grid(p3, p4, ncol=1, labels=LETTERS[1:2])
>
> 

image

Finally, please note that the heatplot is a ggplot2, so if assigned to an object you can easily further fine-tune the plot. See for example here to get some inspiration: #667 (comment)

from clusterprofiler.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.