Irregular gaps in plotly heatmaps

Hello,
I have a question about paddings in plotly heatmaps. Indeed if i want to make a regular sapace between all cells of my heatmap I juste need to do this :

data = np.random.uniform(size= (5,5))
      fig = go.Figure(data=go.Heatmap(z = data,
                                        xgap= 5,
                                        ygap= 5,
                                        colorscale="RdBu_r"))

but the thing I want is for example to left a space each 2 cells in order to make squares of 4, or more. This will give something like this :
image

Is there a way to do this in plotly ?

Thank you in advance

Hey @WinterGrim welcome to the forums.

I don’t think there is smething built in. I could imagine using a Scatterplot for this, but it would require serious manual tweaking of the data. Something like this:

2 Likes

Thank you for your answer. Indeed this implies a lot of data manupulation and since I realy need the heatmap aspect of the thing is seems difficult to do.

Not sure what you are referring to with that.

1 Like

I have an interessting answer in stackoverflow: python - Irregular gaps in plotly heatmaps - Stack Overflow

1 Like