Add text labels to a ggplot object, such as the result from show_sig_profile.
add_labels( p, x, y, y_end = NULL, n_label = NULL, labels = NULL, revert_order = FALSE, font_size = 5, font_family = "serif", font_face = c("plain", "bold", "italic"), ... )
p | a |
---|---|
x | position at x axis. |
y | position at y axis. |
y_end | end position of y axis when |
n_label | the number of label, when this is set,
the position of labels at y axis is auto-generated
according to |
labels | text labels or a |
revert_order | if |
font_size | font size. |
font_family | font family. |
font_face | font face. |
... | other parameters passing to ggplot2::annotate. |
a ggplot
object.
# Load mutational signature load(system.file("extdata", "toy_mutational_signature.RData", package = "sigminer", mustWork = TRUE )) # Show signature profile p <- show_sig_profile(sig2, mode = "SBS") # Method 1 p1 <- add_labels(p, x = 0.75, y = 0.3, y_end = 0.9, n_label = 3, labels = paste0("text", 1:3) ) p1 # Method 2 p2 <- add_labels(p, x = c(0.15, 0.6, 0.75), y = c(0.3, 0.6, 0.9), labels = paste0("text", 1:3) ) p2 # Method 3 sim <- get_sig_similarity(sig2) p3 <- add_labels(p, x = c(0.15, 0.6, 0.75), y = c(0.25, 0.55, 0.8), labels = sim, font_size = 2 ) p3