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

The shape of the point changed when combining two dotplot figures into one figure. #273

Open
ppdpg opened this issue Apr 23, 2024 · 4 comments

Comments

@ppdpg
Copy link

ppdpg commented Apr 23, 2024

When I combine two dotplot figures of the KEGG pathway and GO enrichment results (p1 and p2) into one figure using both patchwork and cowplot::plot_grid, the shape of the point changed from hollow to solid (p3) in the legend of the combined figure.

image
image
image

@ppdpg
Copy link
Author

ppdpg commented Apr 24, 2024

@huerqiang

@guidohooiveld
Copy link

Without showing any code it is impossible to give some help, but maybe this post (from huerqiang) is of relevance: #268 (comment)

@ppdpg
Copy link
Author

ppdpg commented Apr 24, 2024

Here is the code for the dotplot
p1<- dotplot(upkegg,x = "GeneRatio",color="qvalue",font.size=10,
showCategory = 20, label_format = 40,orderBy="qvalue",decreasing = F,
title = 'KEGG Pathway enrichment of
up-regulated EmuH-liver vs EmuL-liver')+ theme(plot.title = element_text(hjust = 0.5))

p2<- dotplot(downkegg2,x = "GeneRatio",color="qvalue",font.size=10,
showCategory = 20,label_format = 40,orderBy="qvalue",decreasing = F,
title = 'KEGG Pathway enrichment of
down-regulated EmuH-liver vs EmuL-liver')+ theme(plot.title = element_text(hjust = 0.5))
#Put p1 and p2 into one figure
keggall<- cowplot::plot_grid(p1, p2, labels=c("A", "B"), rel_widths=c(1, 1))

@guidohooiveld
Copy link

guidohooiveld commented Apr 24, 2024

I can reproduce your problem, but unfortunately I don't have a solution for it. It seems it is being caused by the function plot_grid.... Maybe, when calling plot_grid, some additional arguments could be given to prevent this change from happening?

> library(clusterProfiler)
> library(enrichplot)
> 
> ## load example data 
> data(geneList, package="DOSE")
> 
> genes.up <- names(geneList)[abs(geneList) > 2]
> genes.down <- names(geneList)[abs(geneList) < 2]
> 
> 
> upkegg   <- enrichKEGG(gene         = genes.up,
+                        organism     = 'hsa',
+                        pvalueCutoff = 0.05)
> 
> downkegg <- enrichKEGG(gene         = genes.down,
+                        organism     = 'hsa',
+                        pvalueCutoff = 0.05)
> 
> library(ggplot2)
> 
> ## note: showCategory limited to 5
> p1 <- dotplot(upkegg, x = "GeneRatio",color="qvalue",font.size=10,
+               showCategory = 5, label_format = 40,orderBy="qvalue",decreasing = FALSE,
+               title = 'KEGG Pathway enrichment of up-regulated EmuH-liver vs EmuL-liver') + 
+               theme(plot.title = element_text(hjust = 0.5))
> 
> p2 <- dotplot(downkegg, x = "GeneRatio",color="qvalue",font.size=10,
+               showCategory = 5,label_format = 40,orderBy="qvalue",decreasing = FALSE,
+               title = 'KEGG Pathway enrichment of down-regulated EmuH-liver vs EmuL-liver') + 
+               theme(plot.title = element_text(hjust = 0.5))
> 
> 
> #Put p1 and p2 into one figure
> keggall <- cowplot::plot_grid(p1, p2, labels=c("A", "B"), rel_widths=c(1, 1))
> 
> 
> print(p1)
> 
> print(p2)
> 
> print(keggall)
>

p1:
image

p2:
image

keggall:
image

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