R heatmaply: order the heatmap sidebar legend to match the order of the sidebar

115 views Asked by At

How can I reorder the sidebar legend to match the order of the side bar? In the reprex, I've arranged the data by species and would like the colors in the sidebar legend to share the same order.

library(palmerpenguins)
library(heatmaply)
data("penguins")

penguins <- na.omit(penguins)  %>% 
  dplyr::select(-c(island, year, sex))

# Create heatmap with sidebar column
penguins %>%
  arrange(species) %>%
  heatmaply(
    plot_method = "plotly",
    showticklabels = c(TRUE, FALSE),
    scale = 'column',
    dendrogram = 'none',
    side_color_colorbar_len = 0.4,
    colorbar_xpos = 1.0,
    colorbar_ypos = 0.65
  )
0

There are 0 answers