plots: Switch axes of input data plot

This commit is contained in:
Elias Projahn 2022-05-28 16:15:33 +02:00
parent 49981300fb
commit d144f490a0

View file

@ -39,18 +39,18 @@ plot_positions <- function(species_ids, gene_sets) {
plot <- plotly::plot_ly() |> plot <- plotly::plot_ly() |>
plotly::layout( plotly::layout(
xaxis = list( xaxis = list(title = "Distance to telomeres [Bp]"),
yaxis = list(
title = "Species", title = "Species",
tickvals = species$id, tickvals = species$id,
ticktext = species$name ticktext = species$name
), ),
yaxis = list(title = "Distance to telomeres [Bp]"),
bargap = 0.9 bargap = 0.9
) |> ) |>
plotly::add_bars( plotly::add_bars(
data = species_max_distance, data = species_max_distance,
x = ~species, x = ~max_distance,
y = ~max_distance, y = ~species,
name = "All genes", name = "All genes",
marker = list(color = base_color()) marker = list(color = base_color())
) )
@ -71,8 +71,8 @@ plot_positions <- function(species_ids, gene_sets) {
plot <- plot |> plotly::add_markers( plot <- plot |> plotly::add_markers(
data = gene_set_data[gene %chin% gene_set], data = gene_set_data[gene %chin% gene_set],
x = ~species, x = ~distance,
y = ~distance, y = ~species,
name = gene_set_name, name = gene_set_name,
text = ~ glue::glue( text = ~ glue::glue(
"<b>{name}</b><br>", "<b>{name}</b><br>",