ropensci / iheatmapr

Complex, interactive heatmaps in R
https://docs.ropensci.org/iheatmapr
Other
267 stars 35 forks source link

iheatmapr in shiny is not responsive #84

Open daattali opened 3 years ago

daattali commented 3 years ago

Generally, any output in shiny knows how to adjust its width based on its container. When the width of the browser window changes, outputs expand/shrink automatically to fit in the new width.

This does not seem to be the case for iheatmapr.

Example - in the following app, the plotly plot responds if you change the window size, but the heatmap remains the same size it was initially

library(shiny)

ui <- fluidPage(
    plotly::plotlyOutput("plot"),
    iheatmapr::iheatmaprOutput("heatmap")
)

server <- function(input, output, session) {
    output$plot <- plotly::renderPlotly({
        plotly::plot_ly(mtcars, x = ~mpg, y = ~cyl)
    })

    output$heatmap <- iheatmapr::renderIheatmap({
        mat <- matrix(rnorm(24), nrow = 6)
        annotation = data.frame(gender = c(rep("M", 3),rep("F",3)),
                                age = c(20,34,27,19,23,30))
        iheatmapr::iheatmap(
            mat, 
            cluster_rows = "hclust",
            cluster_cols = "kmeans", 
            col_k = 3, 
            row_annotation = annotation
        )
  })
}

shinyApp(ui, server)
alanocallaghan commented 10 months ago

Again see towards-0.8 branch, maybe not the right solution but works for now