How do I zoom in over multiple vertically stacked subplots together

Hi ,

How will i be able to zoom in like sumultaneosly over all the vertically stacked subplots together. Currently , if i say zoomin , i can only soom in on subplot 1 and rest all subplots remain the same. I am looking for , all the subplots to zoomin together with the same scale.

Can this be achieved ?


1 Like

I have the same request for javascript



In Python, you can share the x or y axes between subplots, as described in this example. The syntax is

fig = make_subplots(rows=3, cols=1, shared_xaxes=True)

In Javascript, here is the codepen corresponding to the Python example above. Note that you have to use the matches property of the different x axes so that they all match together.

Hope this helps!

Thanks Emmanuelle, but it’s not the use case I am interested in. The x axes cannot be shared because they are not on the same scale. The first X axis is defined by [x_min, x_max] and the second by [x_min/(1+z), x_max/(1+z)] (z is a fixed parameter), they are related but different. This use case could be achieved if I could “connect” the zoom event from the first graph to the second, even if they don’t share the same axis. I think it would be a new feature for plotly, but maybe it’s achievable through some hack …



I found a way of doing this by catching zoom event with on(‘plotly_relayout’…) callback and applying it to the other graph using Plotly.relayout . I can make a codepen if someone is interested.