Skip to content

How to adjust the text information of picture made by 'dotplot {enrichplot}' #213

Closed
@PSSUN

Description

@PSSUN

Dear Yu,

I am sorry to bother you in your busy schedule.

Here's my question:
I use dotplot to plot the result of enrichGO with command:
dotplot(ego_mf, showCategory=25,font.size=15)
but in the MF text list on the left, there is a result that is so long that it affects the layout of the entire graph.
example:

neutrophil activation
RNA splicing, via transesterification reactions
RNA splicing, via transesterification reactions with bulged adenosine as nucleophile
mRNA splicing, via spliceosome
nuclear transport

The third line is too long, squeezing the chart on the right. So I want to divide it into two lines. But I did not find the relevant parameters in dotplot. I remember that you mentioned this problem in biobabble. But I did not find it. Could you please give me some advice about it.

Have a nice day!

Activity

jllavin77

jllavin77 commented on Aug 8, 2019

@jllavin77

Dear Yu,

I'm facing the same problem. I tried to export to this case the solution given for barplots,

dotplot(egoBP,font.size=12) + scale_x_discrete(labels=function(egoBP) str_wrap(egoBP, width=10))

but it doesn't work for dotplot.

Have you provided a solution to this issue, because it severely affects the usability of dotplots for publication purposes when labels are too long...

Thanks in advance

jllavin77

jllavin77 commented on Sep 3, 2019

@jllavin77

Dear Yu,
Any insight or example on how to do this?

Thanks

PSSUN

PSSUN commented on Sep 4, 2019

@PSSUN
Author

Dear Yu,
Any insight or example on how to do this?

Thanks


Hi,
I am sure I have find out the way to solve this.
please check this link: link.
Whether your native language is Chinese or not, I believe you can read it because the code and images are displayed in the text.
Have a nice day!

jllavin77

jllavin77 commented on Sep 11, 2019

@jllavin77

PSSUN solution only works for barplots and was already included in my first comment as "not working for dotplots".

GuangchuangYu

GuangchuangYu commented on Sep 12, 2019

@GuangchuangYu
Member

use scale_y_ for dotplot.

jllavin77

jllavin77 commented on Sep 12, 2019

@jllavin77

Dear GuangchuangYu,
Thank you for the insight, now it works like charm.

Best

JL

tilofrei

tilofrei commented on Jul 14, 2020

@tilofrei

Thanks, very helpful comments here. For completeness I'll add the code for dotplot() here:

plot1 = dotplot(my.enricher.obj) + scale_y_discrete(labels=function(x) str_wrap(x, width=40))

If you curate custom gene lists be aware that for text wrapping to be possible you need spaces in your term titles:

library("msigdbr")
custom.gene.lists = msigdbr(species = "Mus musculus", category = "H") %>% dplyr::select(gs_name, entrez_gene)
custom.gene.lists$gs_name = gsub("_", " ", custom.gene.lists$gs_name, fixed = TRUE)
my.enricher.obj = enricher(my.genes.entrez, TERM2GENE=custom.gene.lists)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @GuangchuangYu@tilofrei@PSSUN@jllavin77

        Issue actions

          How to adjust the text information of picture made by 'dotplot {enrichplot}' · Issue #213 · YuLab-SMU/clusterProfiler