Skip to content

Smarter defaults for axis anchors #1200

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

Closed
alexcjohnson opened this issue Nov 25, 2016 · 3 comments
Closed

Smarter defaults for axis anchors #1200

alexcjohnson opened this issue Nov 25, 2016 · 3 comments
Labels
feature something new

Comments

@alexcjohnson
Copy link
Collaborator

We could be smarter about axis anchors for subplots, basing their default values off the traces we have.

In a new mock I made for date axes, there are 7 stacked subplots, each with one trace and its own x and y axes. All the traces have:
xaxis: 'x<n>', yaxis: 'y<n>'
and all the x axes have layout obects:
xaxis<n>: {anchor: 'y<n>'}

With smarter defaults, I would not have needed to include these x axis objects at all since 'x<n>' is only ever used with 'y<n>' in the data. In fact, in principle my y axes should also be anchored to the corresponding x axes... I didn't do that, and it didn't matter here because all the x axes have domain [0, 1], but if I were to change some of these domains, then I would be in for some confusion as the y axes wouldn't move as I would expect.

This would not be backward compatible, so I guess should be included in v2.0 if we do it, but I can't really think of a situation where people would be depending on the existing defaults.

@alexcjohnson
Copy link
Collaborator Author

Just encountered this again as a really peculiar failure mode for gl2d plots: gl2d_stacked_subplots does not have explicit anchors for yaxis2 and yaxis3, which is fine for positioning them (all the x axes have the same left edges) but the plot behaves badly:

  • Open http://localhost:3000/devtools/test_dashboard/#gl2d_stacked_subplots - looks correct initially.
    screen shot 2017-03-31 at 11 52 51 pm
  • Click "autoscale" (or zoom in/out) in the modebar, and all but one subplot gets emptied out:
    screen shot 2017-03-31 at 11 43 31 pm
  • Similar things happen to this plot on Plotly.redraw, Plotly.restyle, and Plotly.relayout calls.
  • Behavior after this is weird too: trying to zoom in the top subplot (with a zoombox) causes the top y axis and the BOTTOM x axis to zoom.
  • The problem is we have xy2 and xy3 subplots as well as x2y2 and x3y3 - for some reason the first time around, these are below the real ones, but on redraw they pop to the top.
  • Keep clicking buttons up there and after a little while you get WARNING: Too many active WebGL contexts. Oldest context will be lost. appearing in the console.

If you explicitly set yaxis2.anchor='x2', yaxis3.anchor='x3' the plot behaves as expected.

@alexcjohnson alexcjohnson mentioned this issue Apr 1, 2017
5 tasks
@alexcjohnson
Copy link
Collaborator Author

I suspect actually that every time anyone has created a plot with a missing axis anchor, it has been incorrect but not noticed because the axis was in the correct location (as in the examples here), so we wouldn't need to wait for v2 to fix this.

Anyway, when we do work on this, we should make sure to test constrained axes in gl2d plots per #1522 (comment)

@gvwilson
Copy link
Contributor

gvwilson commented Jun 6, 2024

Hi - this issue has been sitting for a while, so as part of our effort to tidy up our public repositories I'm going to close it. If it's still a concern, we'd be grateful if you could open a new issue (with a short reproducible example if appropriate) so that we can add it to our stack. Cheers - @gvwilson

@gvwilson gvwilson closed this as completed Jun 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature something new
Projects
None yet
Development

No branches or pull requests

2 participants