Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

heatplot function; color scale is switched #676

Open
zellerivo opened this issue Mar 20, 2024 · 1 comment
Open

heatplot function; color scale is switched #676

zellerivo opened this issue Mar 20, 2024 · 1 comment

Comments

@zellerivo
Copy link


library(DOSE)
data(geneList)
de <- names(geneList)[abs(geneList) > 2]
edo <- enrichDGN(de)
## convert gene ID to Symbol
edox <- setReadable(edo, 'org.Hs.eg.db', 'ENTREZID')

p1 <- heatplot(edox, showCategory=5)
p2 <- heatplot(edox, foldChange=geneList, showCategory=5)
cowplot::plot_grid(p1, p2, ncol=1, labels=LETTERS[1:2])

Hello, the color scale red/blue seems to be switched in version ‘4.11.0.1’ . Positive vaues are assigned blue and negative ones red.
image

@guidohooiveld
Copy link

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants