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

unexpected change of default colors/theme with enrichplot #268

Open
adalgarno opened this issue Jan 24, 2024 · 7 comments
Open

unexpected change of default colors/theme with enrichplot #268

adalgarno opened this issue Jan 24, 2024 · 7 comments

Comments

@adalgarno
Copy link

I am having a similar issue to the one described here (https://support.bioconductor.org/p/9155167/#9155178). The default theme for the dotplots, etc. seems to have changed. Is there a way to revert it to the older theme? I tried the fix mentioned in the post but it had no effect.

Thanks!

@guidohooiveld
Copy link

guidohooiveld commented Jan 29, 2024

This is also a relevant question for me, especially on how to get the dots in the legend (representing the count) filled again...

@huerqiang , @GuangchuangYu : would you mind explaining? Thanks!

Setting/reverting the color scale can thus be done by adding this line before you call the dotplot function.:
options(enrichplot.colours = c("red","blue"))

... but how to revert to have the dots in the legend 'filled' again? Which options-argument to set for that?

@huerqiang
Copy link
Contributor

@adalgarno As guidohooiveld said, options(enrichplot.colours = c("red","blue")) can be used to change back to the default color.
@guidohooiveld I don't quite understand the meaning of this sentence "how to revert to have the dots in the legend 'filled' again" . Can you explain it in more detail?

@guidohooiveld
Copy link

guidohooiveld commented Jan 30, 2024

@huerqiang : thanks for your prompt response!

To illustrate my point I have included 2 graphs below.

The first (combined) one has been generated using the current versions of R/Bioconductor and enrichplot. Changing back the colors indeed works, but the dots in the legend ("Count") do not get filled. See arrow.

The second plot has been generated using old versions of R/Bioconductor and enrichplot. Note that the colors indeed do match with the current version (when the old colors are selected), but that the dots in the legend are also filled. That is what I meant.

> ## using current versions of R/Bioconductor and enrichplot.
> p1 <- dotplot(edo, showCategory=10) + ggtitle("dotplot new colors")
> 
> options(enrichplot.colours = c("red","blue")) 
> p2 <- dotplot(edo, showCategory=10) + ggtitle("dotplot old colors")
>
> R.Version()$version.string
[1] "R version 4.3.0 (2023-04-21 ucrt)"
> BiocManager::version()
[1] ‘3.18’
> packageVersion("enrichplot")
[1] ‘1.23.1’
> 

current_version

> ## using old versions of R/Bioconductor and enrichplot.
> p1 <- dotplot(edo, showCategory=10) + ggtitle("dotplot old version R/BioC")
> 
> R.Version()$version.string
[1] "R version 3.6.3 (2020-02-29)"
> BiocManager::version()
[1] ‘3.10’
> packageVersion("enrichplot")
[1] ‘1.7.1’
> 


oldR

@huerqiang
Copy link
Contributor

That is beacuse we changed the default shape of the point from solid to hollow. If you want to change the original shape, you can set it like this:

library(ggplot2)
library(DOSE)
data(geneList)
de <- names(geneList)[1:100]
x <- enrichDO(de)
dotplot(x) + 
    aes(shape = I(16)) + 
    aes(color = p.adjust) + 
    set_enrichplot_color(type = "color", name = "p.adjust")

@guidohooiveld
Copy link

Yep, that code is indeed doing what I was looking for.

Thanks for the explanation and quick reply!

@adalgarno
Copy link
Author

Yes, this code seems to have reverted the plots. Thank you for your help!

@DarioS
Copy link

DarioS commented Mar 18, 2024

My supervisor hates default R colours and likes pastels like those used in Nature journal plots. The new default is liked by her.

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

4 participants