Consider the following R snippet to render a heatmap with categorical axes:
library(plotly)
x <- c("Blue", "Red")
y <- c("One", "Two")
plot_ly(x = x, y = y, z = c(1:4)) %>%
add_heatmap(
opacity = 0.9
) %>%
add_annotations(
text = c(1:4),
showarrow = FALSE
)
This renders the following heatmap:
The annotations appear to be distributed diagonally and unevenly, starting from the bottom left cell. 1 and 3 are in the bottom left cell, and 2 and 4 in the upper right. Why is this? How should my annotation text be structured for it to be ordered more intuitively (horizontally or vertically)?