@@ -115,6 +115,10 @@ plotConservedDivergedModules <- function(module_conservation, N = 5L, rank_by =
115115 xlab <- paste0(focus , " diversity" )
116116 ylab <- paste0(focus , " subtree length" )
117117 }
118+ x_lwr <- paste0(" lwr_" , x_var )
119+ x_upr <- paste0(" upr_" , x_var )
120+ y_lwr <- paste0(" lwr_" , y_var )
121+ y_upr <- paste0(" upr_" , y_var )
118122
119123 if (is.null(colors )) {
120124
@@ -182,8 +186,21 @@ plotConservedDivergedModules <- function(module_conservation, N = 5L, rank_by =
182186 ggplot2 :: ylab(ylab ) +
183187 ggplot2 :: theme(legend.title = ggplot2 :: element_blank())
184188
185- # Labels
186- p <- p +
189+ if (all(c(x_lwr , x_upr , y_lwr , y_upr ) %in% colnames(module_conservation ))) {
190+
191+ p <- p +
192+ ggplot2 :: geom_errorbar(
193+ ggplot2 :: aes(xmin = .data [[x_lwr ]], xmax = .data [[x_upr ]], color = .data $ category ),
194+ linewidth = 0.2
195+ ) +
196+ ggplot2 :: geom_errorbar(
197+ ggplot2 :: aes(ymin = .data [[y_lwr ]], ymax = .data [[y_upr ]], color = .data $ category ),
198+ linewidth = 0.2
199+ )
200+
201+ }
202+
203+ p +
187204 ggrepel :: geom_label_repel(
188205 data = label_data ,
189206 ggplot2 :: aes(label = .data $ regulator , color = .data $ category ),
@@ -198,6 +215,4 @@ plotConservedDivergedModules <- function(module_conservation, N = 5L, rank_by =
198215 show.legend = FALSE
199216 )
200217
201- p
202-
203218}
0 commit comments