Heatmap bug stretches cells that should not exist

Hi everyone,

I’ve encountered what I think is a bug of plotly/R when drawing a heatmap. There is something similar here, but it refers to plotly.js.

Here is an example of my data:
image

Values between FcCur > 8 and FcCur < 20 do not exist. However, their location is filled by some stretched data points with x = 20. You can see the problem here:

If drawing the same heatmap with ggplot2, the result is correct (edit: data are different, but the result is the same even with data from the above plot that are simply rescaled):

The problem arises both by using ggplotly(ggplot-plot) and the following code:
fig ← plot_ly() %>%
add_trace(data = df_grp_scaled, x=~bsu_FcCur, y =~bsu_Vstack, z =~n, hoverinfo = ‘text’, text =~ text, type = “heatmap”)

Do you have any idea on what could cause the problem?

Thank you in advance,
Giacomo