Skip to content
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

Make inside ticklabels autorange work with scaleanchor or matches #5329

Merged
merged 8 commits into from
Dec 9, 2020

Conversation

archmoj
Copy link
Contributor

@archmoj archmoj commented Dec 8, 2020

Fix the bug that causes infinite axes redraw.

@plotly/plotly_js

@alexcjohnson
Copy link
Collaborator

Good find!

I don't think we're getting the constraints quite right though - and unfortunately I'm worried that we may need to bake the label adjustment in at a deeper level, as constrained autorange now happens inside concatExtremes:

// Include the extremes from other matched axes with this one

That's probably only part of the solution though, as that's just for matches constraints. scaleanchor constraints are handled in constraints.enforce:

* range & factor may need to change because range was
* calculated for the larger scaling, so some pixel
* paddings may get cut off when we reduce the domain.

axes_chain_scaleanchor_matches2_inside-ticklabels.png perhaps shows the issue most clearly: one of the features of axes_chain_scaleanchor_matches2.png that's really useful is comparing successive rows, green vs red, and black vs blue. The left-most red & green subplots should be identical, as should the right-most blue and black, and in both cases the domain-constrained subplots should still fill the available space (dotted rectangle), because within the subplot there's only a matches constraint, which cannot reduce a domain. Yet both the left-most green and right-most black in the inside version have constrained domains, and in the green one this even clips one of the data points.

From one subplot to the next there's a scaleanchor constraint, so subsequent green subplots (and earlier black subplots) should end up with smaller domains, which we do see in the new one. But in axes_chain_scaleanchor_matches2.png the data points in each green subplot are positioned exactly where the red data points are, and same blue vs black, which I believe should still be the case for the inside case, which mostly looks borne out in the inside case, but not for the first green subplot.

ticklabelposition3.png and axes_chain_scaleanchor_matches_inside-ticklabels.png have their x labels overlapping the image / heatmaps a bit, which I suspect is a manifestation of the same issue.

Copy link
Collaborator

@alexcjohnson alexcjohnson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Just 2 small comments and this is ready to go 💃

@archmoj archmoj merged commit dad2472 into master Dec 9, 2020
@archmoj archmoj deleted the inside-ticklabels-scaleanchor-matches branch December 9, 2020 00:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants