The code below
import numpy as np
import plotly.graph_objects as go
def make_blob(n: int) -> np.ndarray:
xx, yy = np.meshgrid(np.arange(n), np.arange(n))
return np.exp(-((xx - n // 2) ** 2 + (yy - n // 2) ** 2) / (2 * (n // 2) ** 2))
if __name__ == "__main__":
n = 101
x = np.arange(n)
blob = make_blob(n)
fig = go.Figure(data=go.Heatmap(x=x, y=x, z=blob, type="heatmap", colorscale="Viridis"))
fig.add_scatter(x=x, y=x)
fig.update_xaxes(range=(0, n - 1))
fig.update_yaxes(range=(0, n - 1))
fig.show()
gives
But pressing โAutoscaleโ on the toolbar will introduce extra padding:
Although it can be removed with โReset axesโ, can I make them not appear in the first place?