-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Implementing matching axes #3506
Conversation
- that way, they are appends across matching axes and the category-to-position maps just works!
- defaults to `false`, when set to `true`, the generated splom axes will match
... so that it works when matching an overlaying axis
... moreovwe, boast relayout perf for non-autorange matching axis groups.
|
||
group = traceOut._groupName = isOverlay ? traceOut.uid : ( | ||
getAxisGroup(fullLayout, traceOut.xaxis) + | ||
getAxisGroup(fullLayout, traceOut.yaxis) + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
N.B. currently, both x and y need to match in order to be considered in the same auto-bin group.
Remaking https://plot.ly/~jackp/16209/machine-learning-classifier-comparison.embed with matching axes gives ➡️ https://codepen.io/etpinard/pen/NojNwY |
This is awesome @etpinard, so much fun to play with!
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 Plotly.newPlot(gd,[
{y:[1,2]},
{y:[1,2],xaxis:'x2',yaxis:'y2'},
{y:[1,2],xaxis:'x3',yaxis:'y3'},
{y:[1,2],xaxis:'x4',yaxis:'y4'}
], {
yaxis: {matches: 'x'},
xaxis2: {scaleanchor: 'y'},
yaxis2: {matches: 'x2'},
xaxis3: {scaleanchor: 'y2'},
yaxis3: {matches: 'x3'},
xaxis4: {scaleanchor: 'y3'},
yaxis4: {matches: 'x4'},
grid: {rows: 2, columns: 2, pattern: 'independent'},
width: 500,
height: 400
}) 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 |
This comment has been minimized.
This comment has been minimized.
@alexcjohnson here's an attempt at satisfying both In that commit, matching Now, about your Plotly.newPlot(gd,[
{y:[1,2]},
{y:[1,2],xaxis:'x2',yaxis:'y2'},
{y:[1,2],xaxis:'x3',yaxis:'y3'},
{y:[1,2],xaxis:'x4',yaxis:'y4'}
], {
yaxis: {matches: 'x'},
xaxis2: {scaleanchor: 'y'},
yaxis2: {matches: 'x2'},
xaxis3: {scaleanchor: 'y2'},
yaxis3: {matches: 'x3'},
xaxis4: {scaleanchor: 'y3'},
yaxis4: {matches: 'x4'},
grid: {rows: 2, columns: 2, pattern: 'independent'},
width: 500,
height: 400
}) in 9f2fad1, we disallowed
from your #1549 (comment) |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
@nicolaskruchten @alexcjohnson would it a big deal if we disallowed simultaneous use of |
In principle that's fine... I would assume that |
In principle you can have both, if you have |
Great. Thanks! Sorry for quitting on this problem, but I'll like to get going on |
... for now, until we found a way to apply domain scaleanchor constraints on matching axes (which is theoretically possible).
Done in 91431ec @plotly/plotly_js this PR is now ready to review 👀 As this PR touches some fairly important cartesian subplot concepts, I'll like both @antoinerg and @archmoj to review this thing. Thanks! |
Just to make sure I get the scaleanchor limitations... it means it’s not possible to have two plots with matched axes that are both constrained to be physically square? |
that's correct. (sorry 😢 ) |
I think that's totally reasonable to start with! |
Ping @archmoj @antoinerg can one of you please review this thing today? Thank you. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@etpinard Excellent!
Please find my few comments below.
@antoinerg it is a 💃 from my side, if you have no more comments? |
It is also a 💃 from me! @etpinard eventually I'd be curious to know what hurdles you ran into and how long or hard it woud be to support constrained axes. Anyway, nice PR 💪 |
That's in -> #3539 |
resolves #1549 - with a ✨ new ✨ cartesian axis attribute
ax.matches
❗Demos:
Matching
x
,x2
andx3
axes:Matching splom axes (notice the constrained zoombox on the diagonal):
Or funkier things, like matching an overlaying axis:
Notable features:
splom
dimension attribute (axis.matches
) to turn on matching axes behavior for splom-generated axes c290adfMore technically, I attempted to reuse most of the
scaleanchor
logic, for better and worse as some things didn't match (pun 😏 ) too well. I also cleaned up a few things in thecartesian_interact_test.js
suite (in 13007e0, e962e96 ca1de5d)I'll tag this thing as
reviewable
, but I'll hunt around for edge cases again on Monday. I'll not 100% convinced thescaleanchor
+matches
mock (added in 8c09944) does the right thing (update: won't be done in this PR). Moreover, I'll try to incorporate #3460 into this branch (done in: 99a9edb)cc @plotly/plotly_js