-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Implement scaleanchor
domain constraints on matching axes
#3539
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
Comments
Mentioned in the community forum https://community.plotly.com/t/synchronizing-view-zoom-of-several-images/39661 |
So we did initially implement support for both of these at once, and it was removed in this commit 91431ec due to the discussion above. For the specific case of faceted images i.e. plotly/plotly.py#2746 however, it seems like the original implementation would have worked just fine, so if we could roll back that commit and re-implement the "dropping" of scaleanchor less blindly, we might be able to get the kinds of scale constraints that Specifically, it seems to me that so long as there is no chain of |
follow-up issue from #3506 where
matches
andscaleanchor
constraints on the same axes are disallowed.Pasting some of @alexcjohnson 's comment on the topic here:
#3506 (comment)
yeah, that one has some problems... looks like after a zoom/pan it manages to satisfy all the constraints (the very shrunken subplots I think are correct), but initially or after an autorange it does not.

Here's a more extreme example. Kind of a pathological case, where each subplot has x&y matching, and the x of each subplot is supposed to scale with the y of the previous... this is the case I think compounds height/width differences, so it should be expected that either the first or last subplot gets its data very compressed if you stretch it to a very non-square size. Right now it appears to apply all the

scaleanchor
constraints, but all thematches
constraints except the last are lost.I haven't looked at your code in detail yet, but in order to satisfy this kind of chained constraints seems to me it may be necessary to generate
scaleanchor
constraints based on eachmatches
constraint (usinggs._w
andgs._h
) and use that to run through thescaleanchor
algorithm, and only after that apply thematches
constraints explicitly.From a private slack convo:
also re: matches and scaleanchor constraints with different target axes - the mock I set up has two separate constraints on each axis (except the ends of the chain). My comment “the only allowed values of scaleanchor would be ‘x’ or nothing.” was about a single constraint, ie the constraint defined within one axis’s attributes. If you’ve already said
yaxis.matches: 'x'
it wouldn’t make sense to sayyaxis.scaleanchor: 'x2'
because that would be setting up a completely different constraint. But it should still be OK to sayxaxis2.scaleanchor: 'y'
. After you’ve already providedmatches
it seemed to me the only purpose ofscaleanchor
is “do you also want to constrain the scale along with the matching constraint”The text was updated successfully, but these errors were encountered: