Skip to content
Snippets Groups Projects
Commit 39efdb15 authored by Simeon's avatar Simeon
Browse files

Update plot_repeats.R

parent a8eca7b1
No related branches found
No related tags found
No related merge requests found
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#' #'
#' @return A ggplot object displaying both positions and quantities of repeated sequences. #' @return A ggplot object displaying both positions and quantities of repeated sequences.
#' @import dplyr forcats stringr tidyr #' @import dplyr forcats stringr tidyr
#' @importFrom cowplot plot_grid ggdraw draw_label
#' @importFrom Biostrings DNAStringSet #' @importFrom Biostrings DNAStringSet
#' @export #' @export
plot_repeats <- function(sequences = DNAStringSet(), plot_repeats <- function(sequences = DNAStringSet(),
...@@ -26,10 +27,21 @@ plot_repeats <- function(sequences = DNAStringSet(), ...@@ -26,10 +27,21 @@ plot_repeats <- function(sequences = DNAStringSet(),
pos_pl <- plot_repeat_positions(pos_data) pos_pl <- plot_repeat_positions(pos_data)
quant_pl <- plot_repeat_quantity(quant_data) quant_pl <- plot_repeat_quantity(quant_data)
combo_pl <- ggpubr::ggarrange(pos_pl, quant_pl) combo_pl <- cowplot::plot_grid(pos_pl, quant_pl)
combo_pl <- ggpubr::annotate_figure(combo_pl, top = ggpubr::text_grob( title <- ggdraw() +
paste('Repeat', repeat_sequence, 'in', clus_name, 'cluster'), draw_label(
vjust = 0.5, x = 0.01, hjust = 0)) paste('Repeat', repeat_sequence, 'in', clus_name, 'cluster'),
fontface = 'bold',
x = 0,
hjust = 0
) +
theme(
# add margin on the left of the drawing canvas,
# so title is aligned with left edge of first plot
plot.margin = margin(0, 0, 0, 7)
)
combo_pl_with_title <- cowplot::plot_grid(title, combo_pl,
ncol = 1, rel_heights = c(.1, 1))
return(combo_pl) return(combo_pl)
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment