heatmaply icon indicating copy to clipboard operation
heatmaply copied to clipboard

Row labels missing when row_dend_left = TRUE

Open bextra opened this issue 8 years ago • 20 comments

I am moving the the dendrogram to the lefthand side by setting row_dend_left = TRUE, but the row labels disappear. Here is a reproducible example:

heatmaply(mtcars, k_col = 2, width = "100%", row_dend_left = TRUE) %>% 
       layout(xaxis= list(tickangle = 45), margin = list(b = 90))

heatmaply(mtcars, k_col = 2, width = "100%", row_dend_left = FALSE) %>% 
       layout(xaxis= list(tickangle = 45), margin = list(b = 90))

I have tried adding extra space using margin - list(r = 180) in case it was just getting cutoff, but nothing shows up still.

Any help would be appreciated.

  • Kristen

bextra avatar Jun 24 '16 23:06 bextra

Hi Kristen, I fear that this parameter is currently not working properly (I should probably remove it for the next release). Sadly, since it appears that ggplot2 does not support placing the Y-axis on the right side of the figures, I don't see a way this ability will be added (unless I'll re-implement the labels text only, but I suspect I won't wish to go down that path soon).

With regards, Tal

talgalili avatar Jun 25 '16 15:06 talgalili

Thank you for letting me know.

bextra avatar Jul 14 '16 14:07 bextra

Hi Tal, I can confirm the same issue as @kbeck527. I wouldn't recommend removing the row_dend_left = TRUE feature, as 99.9% of all biological heatmaps I've ever seen have included this dendrogram on the left (and the row labels on the right). Best regards, Bohdan

Bohdan-Khomtchouk avatar Sep 10 '16 07:09 Bohdan-Khomtchouk

Thanks Bohdan, This is currently a problem to implement since right side axis labels are not implemented in ggplot2. But I'll keep this open for the future in case I'll get to implement this in another way that would solve this (specifically, to add a panel with text that would replace the ggplot2 default labels).

With regards, Tal

talgalili avatar Sep 10 '16 21:09 talgalili

Thank you very much, Tal. That would, indeed, be a nice useful addition to your (already) fantastic R package.

Kind regards, Bohdan

Bohdan-Khomtchouk avatar Sep 10 '16 21:09 Bohdan-Khomtchouk

This feature may become possible with ggplot v2.2 (scheduled for release very soon): https://blog.rstudio.org/2016/09/30/ggplot2-2-2-0-coming-soon/

alanocallaghan avatar Nov 06 '16 15:11 alanocallaghan

Thanks @Alanocallaghan . I've also noticed it when this was announced :)

I am looking forward to see if it can indeed be used. You are welcome to give it a look yourself, the ggplot github reop has that version. I won't get to do it myself in the next two weeks.

With regards, Tal

talgalili avatar Nov 06 '16 15:11 talgalili

p.s. @Alanocallaghan : could you please send me your email? (to: [email protected] )

talgalili avatar Nov 06 '16 15:11 talgalili

@talgalili

I've made some progress on this and #20, by adding an option to use native plot_ly functionality (in lieu of ggplotly). I'll try to do some informal testing and maybe write some formal testthat tests for the package when I get time and submit a PR.

Feel free to have a look and do some informal testing too if you have time; you can switch to plotly functionality using the parameter plot_method = "plotly" - the default is still to use ggplotly

alanocallaghan avatar Feb 18 '17 13:02 alanocallaghan

Should clarify this is on my fork https://github.com/Alanocallaghan/heatmaply

alanocallaghan avatar Feb 18 '17 13:02 alanocallaghan

This is now possible when using the new option, plot_method = "plotly". Hopefully, it will be possible in ggplotly; once this PR is resolved, it will be fixed with plot_method = "ggplot" (currently the default)

alanocallaghan avatar Apr 10 '17 10:04 alanocallaghan

Hi @Alanocallaghan How would you make this look o.k.:

library(heatmaply)
heatmaply(mtcars, plot_method = "plotly", row_dend_left = TRUE)

?

image

(thanks)

talgalili avatar Apr 10 '17 11:04 talgalili

I would add left and possibly top margin to the plot. Unfortunately plotly does not dodge legends, but I may have though of a hack/workaround to avoid this.

alanocallaghan avatar Apr 10 '17 11:04 alanocallaghan

Try now; I permanently moved the legend off the left side of the plot. It may make more sense to add parameters to move the x and y location, because I don't know if you could design a method that would always dodge all elements without taking up unnecessary amounts of space

alanocallaghan avatar Apr 10 '17 12:04 alanocallaghan

I'm off to Pesach dinner. I'll continue this tomorrow :)

Hag Sameach (happy holiday) if you're celebrating one of them (Pesach/easter), Tal

talgalili avatar Apr 10 '17 14:04 talgalili

Depends https://github.com/ropensci/plotly/pull/929

alanocallaghan avatar Aug 20 '17 16:08 alanocallaghan

Row label is still omitted when the dendrogram is on the left. Is this issue able to be fixed? Thanks!

laurenfitch avatar Nov 01 '18 16:11 laurenfitch

As noted above, it depends on ropensci/plotly#929 being resolved.

alanocallaghan avatar Nov 01 '18 16:11 alanocallaghan

Sorry, I read through that thread too but the current status wasn't clear to me. The most recent comment is over a year old. Thanks.

laurenfitch avatar Nov 01 '18 16:11 laurenfitch

No worries, I had to check also. Just pinged Carson regarding it - I'd like to contribute but I think it grew in scope far beyond my knowledge of the plotly package. Cheers Alan

alanocallaghan avatar Nov 01 '18 17:11 alanocallaghan