From b17eb049d19bb196a3638bd00de22b0282055c60 Mon Sep 17 00:00:00 2001 From: Elias Projahn Date: Thu, 19 May 2022 17:09:19 +0200 Subject: [PATCH] Add hover information to positions plot --- R/plots.R | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/R/plots.R b/R/plots.R index f71d715..fa31d3b 100644 --- a/R/plots.R +++ b/R/plots.R @@ -410,6 +410,13 @@ plot_scores_by_position <- function(ranking, by = "gene" ) + data <- merge( + data, + geposan::genes, + by.x = "gene", + by.y = "id" + ) + data[, `:=`(gene_set = "All genes", color = base_color())] index <- 1 @@ -432,7 +439,13 @@ plot_scores_by_position <- function(ranking, x = ~start_position, y = ~score, name = ~gene_set, - hoverinfo = "skip" + text = ~name, + hovertemplate = paste0( + "%{text}
", + "Position: %{x:.0} Bp
", + "Score: %{y:.3}
", + "" + ) ) |> plotly::layout( xaxis = list(title = "Position (Bp)"),