From 1f5909cc026c790907c377329019310f1c73d8fe Mon Sep 17 00:00:00 2001 From: Elias Projahn Date: Mon, 6 Dec 2021 11:17:11 +0100 Subject: [PATCH] plots: Improve scores plot performance --- R/plots.R | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/R/plots.R b/R/plots.R index aa358da..55832e2 100644 --- a/R/plots.R +++ b/R/plots.R @@ -156,13 +156,17 @@ plot_scores <- function(ranking, gene_sets = NULL, max_rank = NULL) { stop("Please install \"plotly\" to use this function.") } + # To speed up rendering, don't show every single gene. + sample_ranking <- ranking[seq(1, nrow(ranking), 5)] + plot <- plotly::plot_ly(colors = "Set2") |> - plotly::add_markers( - data = ranking, + plotly::add_lines( + data = sample_ranking, x = ~rank, y = ~score, color = "All genes", - hoverinfo = "skip" + hoverinfo = "skip", + line = list(width = 4) ) |> plotly::layout( xaxis = list(title = "Rank"),