Plotly 4.5.2 update broke my rectangular heatmap
plotly, r
Solution
I think it is a bug, but specifying as many variables as `max(dim(m))` will fix your code.
set.seed(123)
m <- matrix(rnorm(8), nrow = 4, ncol = 2)
dim(m)
plot_ly(
x = c(letters[1:2], "NA", "NA"), y = letters[3:6],
z = m, type = "heatmap")
Problem
I've updated plotly package, and now I am having issues with my heatmap. ``` m <- matrix(rnorm(8), nrow = 4, ncol = 2) plot_ly( x = c("a", "b"), y = c("c", "d", "e", "f"), z = m, type = "heatmap" ) ``` gives me an error: ``` Error: Variables must be length 1 or 4. Problem variables: 'x' ``` Any idea on how to fix it? Adding empty labels did not help. The only solution that actually worked was repeating vector ``` x = c("a", "b", "a", "b") ``` or ``` x = c("a", "b", "b", "b") ``` However I would like to have a more neat solution, as with a bigger dataset it could get messy.