Black Lives Matter. Please consider donating to Black Girls Code today.

Disabling zoom and pan for a heatmap

Hi!

I have made a drill-down heatmap on Dash and I want to disable zoom and pan functionality.
I tried staticPlot but that blocks me from using click data which I need for user interaction with the heatmap.
I tried using fixedrange as well but that does not appear to exist for heatmaps.

I would like to avoid users accidentally messing up the view and ideally prevent the cursor from changing into the cross-hairs as well.

Any advice or suggestions?

Thanks!

Hi @shanv, welcome to the forum! fixedrange is indeed the way to go, see the example below

import plotly.graph_objects as go
import numpy as np
z = np.random.random((10, 10))
fig = go.Figure(go.Heatmap(z=z))
fig.update_xaxes(fixedrange=True)
fig.update_yaxes(fixedrange=True)
fig.show()

That did the trick. Thanks a lot!

I was attempting to set fixedrange to True without the update_axes functions