-
-
Notifications
You must be signed in to change notification settings - Fork 358
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature request: link/share axes (like sharex in matplotlib or linkaxes in Matlab) #1371
Comments
@apalugniok That depends, when you pan or zoom one of the subplots with the mouse, does the other's y axis update so the y axes always match? |
No it doesn't. Given the current implantation of |
PyPlot supports it (see example above), and it looks like PlotlyJS should be able to: https://plot.ly/javascript/subplots/#subplots-with-shared-axes |
Nice, thanks for the research! 😄 It'll come in handy! |
It should be possible and fairly simple in backends that support it natively (e.g. pyplot and plotlyjs) to check whether axes are linked then pass the appropriate keyword to the backend. |
@apalugniok I'm not sure where the problem is with your example as I haven't used Plotly directly in JavaScript before. But starting with their example (https://plot.ly/javascript/subplots/#subplots-with-shared-axes) and poking around a bit this is an MWE that has the functionality I'm looking for: https://codepen.io/anon/pen/yveXJo. Maybe the difference is having the plots stacked vertically instead of horizontally? If the latter wasn't possible that would be ok; for me at least the Nx1 subplots case with linked x axes is the most interesting. |
So it does seem that |
@apalugniok I'd like to but am running into an error. This the the first time I've tried
|
It's a little more complex than that, because the PR comes from @apalugniok 's local fork of Plots. You need to use git to set up his fork as a remote in your repo, then use git (also outside julia) to checkout the branch. |
Wow, do all those subplots get generated from just those lines of code?!? Very cool. It might be a little while before I can find time to check the branch out and try this myself but based on the demo I think this is basically what I'm looking for and you should go ahead and merge if all else looks good. Probably unrelated but I notice that when panning new tick labels for the revealed parts of the plot aren't drawn. Is that just a plotly thing (pretty sure matplotlib doesnt' behave that way) and if so a known issue? Thanks for working this! |
Yup! That code is all it takes 😄 The lack of ticks when panning is a Plots issue which also causes ticks not to be updated when zooming in (#1382). |
Should be implemented by #1378! |
I have tried several backends that have interactive pan/zoom (PlotlyJS, PyPlot, InspectDR) and the
link
kwarg doesn't appear to have any effect in them. I'm not sure about the others but using PyPlot directly does work, e.g.:The text was updated successfully, but these errors were encountered: