talgalili / heatmaply

Interactive Heat Maps for R Using plotly
377 stars 73 forks source link

[FEATURE] Separate colorbars for multiple row annotations #284

Open sergiumocanu opened 1 year ago

sergiumocanu commented 1 year ago

Hi,

Thank you for making an awesome heatmap package integrated with plotly.

I'm wondering, is it possible to separate the colorbars of multiple row annotations into their own separate colorbars?

row_side_colors <- data.frame(iris[, 4:5])
heatmaply::heatmaply(
    iris[, 1:3],
    plot_method = "plotly",
    row_side_colors = row_side_colors
)

Here both annotations are combined in one colorbar.

image

Thanks in advance!

alanocallaghan commented 1 year ago

Yes, mostly, although it is sometimes inconsistent. See eg https://stackoverflow.com/questions/60458220/two-or-three-colorbars-for-one-plot-in-plotly

sergiumocanu commented 1 year ago

Thank you @Alanocallaghan for the suggestion. However, that's not really the same thing. They are just plotting a second scatter plot trace and adding its corresponding colorbar.

In my example, the colorbars are combined together into one, even though I would like Species and Petal.Width to have their own bars.

alanocallaghan commented 1 year ago

You asked

is it possible to separate the colorbars of multiple row annotations into their own separate colorbars?

I replied with an example documenting use of multiple colorbars with a note about my experience in trying to implement this myself in heatmaply, so I can revisit this later. I wasn't trying to say they were identical