mirror of
https://github.com/johrpan/geposan.git
synced 2025-10-26 10:47:25 +01:00
Add hover information to positions plot
This commit is contained in:
parent
e41d02c659
commit
b17eb049d1
1 changed files with 14 additions and 1 deletions
15
R/plots.R
15
R/plots.R
|
|
@ -410,6 +410,13 @@ plot_scores_by_position <- function(ranking,
|
||||||
by = "gene"
|
by = "gene"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
data <- merge(
|
||||||
|
data,
|
||||||
|
geposan::genes,
|
||||||
|
by.x = "gene",
|
||||||
|
by.y = "id"
|
||||||
|
)
|
||||||
|
|
||||||
data[, `:=`(gene_set = "All genes", color = base_color())]
|
data[, `:=`(gene_set = "All genes", color = base_color())]
|
||||||
|
|
||||||
index <- 1
|
index <- 1
|
||||||
|
|
@ -432,7 +439,13 @@ plot_scores_by_position <- function(ranking,
|
||||||
x = ~start_position,
|
x = ~start_position,
|
||||||
y = ~score,
|
y = ~score,
|
||||||
name = ~gene_set,
|
name = ~gene_set,
|
||||||
hoverinfo = "skip"
|
text = ~name,
|
||||||
|
hovertemplate = paste0(
|
||||||
|
"<b>%{text}</b><br>",
|
||||||
|
"Position: %{x:.0} Bp<br>",
|
||||||
|
"Score: %{y:.3}<br>",
|
||||||
|
"<extra></extra>"
|
||||||
|
)
|
||||||
) |>
|
) |>
|
||||||
plotly::layout(
|
plotly::layout(
|
||||||
xaxis = list(title = "Position (Bp)"),
|
xaxis = list(title = "Position (Bp)"),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue