Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it possible to remove or reposition the RowSideColors annotation legend? #236

Open
jeremycfd opened this issue Apr 12, 2020 · 3 comments

Comments

@jeremycfd
Copy link

Hello!

When creating a plot with a lot of RowSideColors, the RowSideColors legend tends to get a bit unwieldy and can overlap with the actual legend. I've found that setting plot_method = "plotly" helps compact the RowSideColors annotations, but again when there is a long list it ends up pushing the legend to weird parts of the plot. Is there a way to remove the Row annotations legend entirely while keeping the RowSideColors?

Thanks!

@Cattiva
Copy link

Cattiva commented Dec 11, 2020

Hi,
I encounter the same problem. I have to use plot_method = "plotly" to set a custom hover text, but this causes the Row/ColSideColors legend to appear again, even if hide_colorbar = TRUE.
If I use plot_method = "ggplot", the RowSideColors legend is removed.

image

This is the code I used:
image

@alanocallaghan
Copy link
Collaborator

Please include your actual code as a reproducible example, not a screenshot of your code

@Cattiva
Copy link

Cattiva commented Dec 14, 2020

I'm really sorry. Late Friday at work had me lose my good manners... Here you go with a reprex:

library(magrittr)

set.seed(123)

heatmap_input <- tibble::tibble(x = runif(3),
                                y = runif(3),
                                z = runif(3),
                                sector = c("a", "b", "c")) %>% 
  tibble::column_to_rownames(var = "sector") %>% 
  as.matrix()

row_side <- runif(3)
col_side <- runif(3) %>% 
  setNames(colnames(heatmap_input))


main_Heatmap <- heatmaply::heatmaply(
  heatmap_input,
  row_side_colors = tibble::tibble("<b>Sector Relevance Total</b>" = row_side),
  col_side_colors = tibble::tibble("<b>Covered Portfolio NAV</b>" = col_side),
  #col_side_palette = colCopheneticCor,
  #row_side_palette = rowCopheneticCor,
  dendrogram = "none",
  #custom_hovertext = text_mat_main,
  plot_method = c("plotly"),
  hide_colorbar = TRUE) %>%
  plotly::layout(showlegend = FALSE,
                 annotations = list(
                   visible = FALSE
                 ))

Created on 2020-12-14 by the reprex package (v0.3.0)

image

Many thanks for looking into this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants