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.
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.
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.
Hi, I have exactly the same problem and I would be interested in an example how to best do this.
What I’m most worried about is that I will get circular callbacks when applying the zoom to the other subplot so I guess we will need some hidden state?
I’ll try to make a simple example on codepen if that’s not clear enough (I cannot share my code for the moment and and anyway there are too many other things to be meaningful).
Thanks a lot @aliallaoui for the response. Actually I missed that you pointed out above that you are interested in JS plotly. I need to do it in Python. But I get the idea from your example and now I’m thinking I might achieve something similar with client side callbacks.