Open xsswang opened 5 years ago
Thanks @xsswang for raising the issue. This is actually due to a limitation of plotly (or at least for the version used here). What setting showlegend = TRUE
is doing is saying that if you made more than one bar/line plot then those would get added to a legend. See for example:
main_heatmap(da, name = "Score", x_categorical = TRUE,y_categorical=TRUE) %>%
add_col_labels(font = list(size = 12)) %>%
add_row_labels(size = 0.1,font = list(size = 12), side="right")%>%
add_col_barplot(y=db$value, color=as.character(gcolor), tracename='Group',showlegend=TRUE) %>%
add_row_barplot(x=1:20, tracename='bah',showlegend=TRUE)
It doesn't actually refer to making a legend for the colors provided for that trace itself... which isn't great in terms of obvious/desired behavior.
First, thanks for the great package. I'm using the package for heatmap with barplot as annotation. I noticed that "showlegend" option seems not functioning for showing color legend when barplot with coloring. Here is an example
One option would be to use add_col_annotation(data.frame("Groups" = g), colors=list("Groups"=colors)) to get the legend. I try to avoid this option. Thanks in advance