@@ -68,8 +68,7 @@ enrichItPlot <- function(res,
6868 if (plot.type == " bar" ) {
6969 p <- ggplot2 :: ggplot(res ,
7070 ggplot2 :: aes(x = .data [[x.measure ]], y = .data $ Term )) +
71- ggplot2 :: geom_col(fill = .colorizer(palette , n = 1 ), ... ) +
72- ggplot2 :: facet_wrap(~ Database , scales = " free_y" ) +
71+ ggplot2 :: geom_col(fill = .colorizer(palette , n = 1 )) +
7372 ggplot2 :: labs(x = x.measure , y = NULL ) +
7473 ggplot2 :: theme_classic()
7574
@@ -80,19 +79,14 @@ enrichItPlot <- function(res,
8079 hjust = 0 , size = 3 )
8180 }
8281 p <- p + ggplot2 :: coord_cartesian(clip = " off" )
83- return (patchwork :: wrap_plots(p ))
84-
8582 # # Dot Plot
8683 } else if (plot.type == " dot" ) {
87- if (! requireNamespace(" patchwork" , quietly = TRUE ))
88- stop(" Install 'patchwork' for facetted output." )
8984
9085 p <- ggplot2 :: ggplot(res ,
9186 ggplot2 :: aes(x = .data $ geneRatio , y = .data $ Term ,
9287 color = .data [[color.measure ]],
9388 size = .data $ size * .data $ geneRatio )) +
9489 ggplot2 :: geom_point(... ) +
95- ggplot2 :: facet_wrap(~ Database , scales = " free_y" ) +
9690 ggplot2 :: scale_size_continuous(name = " Core Count" ) +
9791 ggplot2 :: labs(x = " geneRatio" , y = NULL ,
9892 color = color.measure ) +
@@ -101,8 +95,6 @@ enrichItPlot <- function(res,
10195
10296 if (! is.null(palette ))
10397 p <- p + ggplot2 :: scale_color_gradientn(colors = .colorizer(palette , 11 ))
104- return (patchwork :: wrap_plots(p ))
105-
10698 # Network Plot
10799 } else {
108100 if (! requireNamespace(" ggraph" , quietly = TRUE ))
@@ -126,7 +118,7 @@ enrichItPlot <- function(res,
126118 igraph :: V(g )$ type <- ifelse(igraph :: V(g )$ name %in% res $ pathway , " pathway" , " gene" )
127119 igraph :: V(g )$ size <- ifelse(igraph :: V(g )$ type == " pathway" , 8 , 3 )
128120
129- ggraph :: ggraph(g , layout = " fr" ) +
121+ p <- ggraph :: ggraph(g , layout = " fr" ) +
130122 ggraph :: geom_edge_link(aes(alpha = after_stat(index )), show.legend = FALSE ) +
131123 ggraph :: geom_node_point(aes(size = .data $ size ,
132124 color = .data $ type )) +
@@ -135,5 +127,8 @@ enrichItPlot <- function(res,
135127 vjust = 1.5 , check_overlap = TRUE ) +
136128 ggplot2 :: scale_color_manual(values = .colorizer(palette , n = 2 )) +
137129 ggplot2 :: theme_void()
130+
131+
138132 }
133+ return (p )
139134}
0 commit comments