How to make Range slider for 2D data array?

I’m new to plotly, how do I make a range slider for a 2d dataset?

xg = np.random.rand(100, 400)

fig = px.imshow(xg, color_continuous_scale=‘gray’)

fig.show()