Any way to get plotly zoom selection?

Is there any way to get the plotly zoom selection?
ie the axis x & y values?

Generally speaking you can do something like this (from the Plotly documentation)

fig.update_xaxes(range=[1.5, 4.5])
fig.update_yaxes(range=[3, 9])

However, as Plotly4 hasn’t been deployed on Anvil yet it may not work. You could try adding a rangeslider as such:

self.plot_name.layout.xaxis.rangeslider.range = [1.5, 4.5]

Where you would change the name of the plot to match yours and the list to be the lower and upper bounds of the range. This has the added benefit of adding a range slider to your chart that can allow users to scroll through the data.

1 Like