Open ismirsehregal opened 2 years ago
Inside renderPlot, assigning the pheatmap to an object and printing it should solve the issue (i.e. works for me) Also, call dev.off() before launching the app to avoid interferences
output$plot2 <- renderPlot({
this_map <- pheatmap(scale(iris[1:4]))
print(this_map)
})
Hi, I have the same problem, I tried the print(plot) solution and it does not work. Also, dev.off() does work, but it means that when I interact with the app during the session (change heatmap input data) the heatmap disappears again.
Exact same issue. Is there a javascript magic code that might trigger the process called when the window is resized?
I have 2 pheatmaps on the same page build from 2 different omics but in a very similar workflow. one always gets plotted in shiny. The other does not cooperate with shiny and never seemed to show up. Only here I learned that resizing the window and re-rendering helps to show the plot. Great, but how can I make this plot permanent? I can export the other as rds file and plot outside shiny without any problems. Something must be wrong with the plot. How can I troubleshoot the code of the pheatmap object to find the problem? There is no error or warning shown when I generate the plot.
Same issue. Is there any solution for that?
Hi guys, I was having the same problem and none of the suggestions worked for me.
What worked for me (I have no clue why) was to assign the results of the pheatmap function to an object and render it.
app.R
library(shiny)
library(pheatmap)
ui <- fluidPage(
plotOutput("plot2", height = 500)
)
server <- function(input, output) {
hm <- pheatmap(scale(iris[1:4]))
output$plot2 <- renderPlot({
hm
})
}
shinyApp(ui, server)
Hopefully it works for some of you or helps for the bug to be solved :)
Same issue. Is there any solution for that?
In my case, I have tried many ways to solve it, but when I start the app via RStudio, it still has this issue(sometimes worked out, but most of the time not). However, when I start the app via the command line(just run: Rscript app.R) without changing one line of code, it always works perfectly and also works well after deployment. So, I believe there are some issues with RStudio while using pheatmap.
Coming from here (or here or here) - When a pheatmap plot is embedded in a shiny app it is rendered only after the browser window was resized: