Open adalgarno opened 10 months ago
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?
@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?
@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’
>
> ## 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’
>
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")
Yep, that code is indeed doing what I was looking for.
Thanks for the explanation and quick reply!
Yes, this code seems to have reverted the plots. Thank you for your help!
My supervisor hates default R colours and likes pastels like those used in Nature journal plots. The new default is liked by her.
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!