-
Notifications
You must be signed in to change notification settings - Fork 73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Too-long column names cause Shiny render to fail silently #294
Comments
One more comment - it's not due to the dendrogram rendering either. We get the same result if we disable dendrogram things with heatmaply_mat <- matrix(runif(36), nrow = 6)
long_colname <- paste(sample(letters, 46, replace = TRUE), collapse = "")
colnames(heatmaply_mat) <- c(head(letters, 5), long_colname)
hmc <- heatmaply(heatmaply_mat, Rowv = FALSE, Colv = FALSE)
ui <- fluidPage(plotlyOutput("heatmaply_object"))
server <- function(input, output){
output$heatmaply_object <- renderPlotly(hmc)
}
shinyApp(ui, server) |
Thanks for the bug report, the details are super useful and very much appreciated. I'll look into this later today but as I'm not a shiny expert I can't guarantee a quick fix |
It seems like a plotly issue with (sub)plots that are too large for the given window, which I can replicate with: heatmaply_mat <- matrix(runif(36), nrow = 6)
long_colname <- paste(sample(letters, 2000, replace = TRUE), collapse = "")
hmc <- plot_ly(z=heatmaply_mat, type = "heatmap",
y=c(head(letters, 6)),
x=c(head(letters, 6)))
sp <- subplot(replicate(20, hmc, simplify = FALSE))
ui <- fluidPage(plotlyOutput("heatmaply_object"))
server <- function(input, output){
output$heatmaply_object <- renderPlotly(sp)
}
shinyApp(ui, server) Probably plotly/plotly.js#4155 |
Glad it's useful! The example you give above seems to maybe be a separate issue though, one relating to shiny not rendering more than 16 heatmap subplots no matter the size of the window independent of the length of the row/column names.
This works as expected, with the heatmaps rendering both in RStudio and in browser:
This one (with 20 subplots) fails in the Shiny app even though it renders just fine in the RStudio "Viewer" window
This one (16 subplots, long column names) seems to render just fine (although the long column name chaotically runs behind the plots below it):
as does this one with long row names:
Does |
Seems like a ggplotly thing, which is likely to make it a nightmare to debug. eg this works fine for me: library(heatmaply)
library(shiny)
library(plotly)
heatmaply_mat <- matrix(runif(36), nrow = 6)
long_colname <- paste(sample(letters, 50, replace = TRUE), collapse = "")
colnames(heatmaply_mat) <- c(head(letters, 5), long_colname)
hmc <- heatmaply(heatmaply_mat, plot_method="plotly")
ui <- fluidPage(
plotlyOutput("heatmaply_object")
)
server <- function(input, output){
output$heatmaply_object <- renderPlotly(hmc)
}
shinyApp(ui, server) |
Oof, yep. Can confirm it works fine for me under |
Hi, super neat package you've got here and one I've found invaluable for data exploration and visualization. I ran into a super strange bug by trying to embed a heatmaply object into a Shiny app, but found that if the column names of the provided matrix were too long then the heatmap wouldn't render at all.
Here's an MWE of the problem:
The character limit seems to be set to 45 - rownames of length 45 render fine, but length 46 fail.
It seems to only affect column names - row names can exceed the 45 character limit and not cause problems
This does seem like a particularly weird heatmaply x shiny problem, as plotly alone can handle long column & row names:
I'm not really familiar enough with the source code to go digging for a solution and it's not critical because I can just abbreviate the row names, but wanted to make sure this was documented for anyone else running into this bizarre problem.
The text was updated successfully, but these errors were encountered: