talgalili / heatmaply

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

to place the column names at the top instead of the default bottom? #256

Closed altayg closed 3 years ago

altayg commented 4 years ago

Is your feature request related to a problem? Please describe.

Is there a simple way to place the column names at the top of the heatmap instead of the default bottom? The deafult and all the examples in their website the column names are at the bottom.

Describe the solution you'd like

A simple variable to set so that the column names appear at the top.

alanocallaghan commented 4 years ago

I think this is non-trivial to implement, see https://github.com/ropensci/plotly/issues/808

library(plotly)
ggplot(mtcars, aes(cyl, mpg)) + geom_point()
g <- ggplot(mtcars, aes(cyl, mpg)) + geom_point()
g2 <- g + scale_x_continuous(position="top")

If you can find a way to make ggplotly(g2) have the axis on top then this is maybe workable

aha-incom commented 3 years ago

Hey, this should do:

library(heatmaply)
library(magrittr)
library(plotly)
heatmaply::heatmaply(mtcars, Rowv = FALSE,
                     Colv = FALSE) %>% 
  layout(xaxis = list(side = "top"))
alanocallaghan commented 3 years ago

It seems to yeah, thanks!

aha-incom commented 3 years ago

No problem, I can see that it overlays with the dendogram though. I usually don't use the dendogram in the viz I'm working with, but there might be a fix to that as well