plots: Rotate and simplify boxplot

This commit is contained in:
Elias Projahn 2022-08-18 11:57:46 +02:00
parent c8b94fade8
commit ba55aa124e

View file

@ -453,15 +453,16 @@ plot_boxplot <- function(ranking, gene_sets = NULL) {
plot <- plotly::plot_ly() |> plot <- plotly::plot_ly() |>
plotly::add_boxplot( plotly::add_boxplot(
data = ranking, data = ranking,
x = "All genes", x = ~score,
y = ~score, y = "All genes",
name = "All genes", name = "All genes",
showlegend = FALSE, showlegend = FALSE,
boxpoints = FALSE,
line = list(color = base_color()) line = list(color = base_color())
) |> ) |>
plotly::layout( plotly::layout(
xaxis = list(tickvals = c("All genes", names(gene_sets))), xaxis = list(title = "Score"),
yaxis = list(title = "Score") yaxis = list(tickvals = c("All genes", names(gene_sets)))
) )
if (length(gene_sets) > 0) { if (length(gene_sets) > 0) {
@ -472,10 +473,11 @@ plot_boxplot <- function(ranking, gene_sets = NULL) {
plot <- plot |> plotly::add_boxplot( plot <- plot |> plotly::add_boxplot(
data = ranking[gene %chin% gene_set], data = ranking[gene %chin% gene_set],
x = gene_set_name, x = ~score,
y = ~score, y = gene_set_name,
name = gene_set_name, name = gene_set_name,
showlegend = FALSE, showlegend = FALSE,
boxpoints = FALSE,
line = list(color = gene_set_color(index)) line = list(color = gene_set_color(index))
) )