Repository navigation
FIX: Apply aspect before drawing starts - #11753
Conversation
a2f0415 to
f120164
Compare
|
I wonder if there is a good way to create a test for this?
As for moving the apply aspect, I think it should be in both places, but
perhaps we can add some logic to detect that it has already happened?
…On Mon, Jul 23, 2018 at 1:23 PM, Jody Klymak ***@***.***> wrote:
Ping @leejjoon <https://github.com/leejjoon> who's comment over at #4375
<#4375> inspired this.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#11753 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AARy-CYXGBX9o767ju5clwoHX2cRviUmks5uJgargaJpZM4VbYVF>
.
|
|
Agreed, this definitely needs a test. Happy to keep it in twice. I don't think its really very slow and makes life a lot more consistent... |
4f17959 to
b53f410
Compare
|
Actually to pass the tests, we need the apply_aspect in the draw as well. |
|
Failing test is just the macOS small tolerance issue, not this PR... Note this fixes an annoyance in the zoom-inset example where the indicators didn't line up (grey lines in the plots).... BeforeAfter |
e7b4b43 to
87cb53c
Compare
|
Milestoning as 3.1, as this has been a long-standing problem with linked artists between axes, and I know we want to get 3.0 out. OTOH, it would be nice to see it get into 3.0, and even 2.2.3 because it really does fix any plot that has artists that depend on the proper axes location to draw. |
87cb53c to
cc44df8
Compare
cc44df8 to
887c9d2
Compare
|
Rebased on master. I still think this would be good for 3.0, because it really fixes some long-term annoyances... |
|
I don’t think this needs a rebase ;-) |
887c9d2 to
cbbaca2
Compare
|
Ooops, I guess it did - rebase complete! |
|
You have flake8 errors: |
|
If you need to |
|
I think the problem is that Connection patches attach two axes but they are the child of only one axes and you can’t control if the other axes has been drawn yet. |
|
Refactoring the drawing order wouldn't be too hard, but I think would make the code a lot less clear.
Scratch that - the user could change a lot about the axes after its aspect is set that would change its physical size (i.e. the x/y limits) and hence the apply_aspect needs to be done at draw time. |
cbbaca2 to
c4a2feb
Compare
c4a2feb to
7d76522
Compare
ImportanceOfBeingErnest
left a comment
There was a problem hiding this comment.
Approving since there seems currently no easy alternative than to call apply_aspect this soon.
|
Not sure in how far this could go into 3.0.x, since it's mainly a bug fix? |
|
Yeah but not a regression (it’s basically always been this way) so we don’t usually backport. |
|
This has two approvals... I'm hesitant to self-merge in case someone else wants to make sure it makes sense... |
7d76522 to
a4e7ddd
Compare
|
Rebased. Will merge if passes CI.... |



PR Summary
As noted in #4375 (comment) connection patches between artists with different transforms do not always work on the first draw, though they will on the second draw. This happens because
apply_aspecthappens at draw time for axes, and not always in the order necessary for these connections to take place properly.This PR proposes calling
apply_aspecton all axes in a figure before they are drawn. This positions them properly before the draw, and makes these kinds of connectors work.Pro: connector patches (annotate) work.
Con:
apply_aspectgets called twice.I've removed theapply_aspectcall fromax.draw. So the aspect is applied at the figure level rather than at each axes. This isn't necessary - it can be in both places, but that has extra overhead. However, I'm not 100% certain thatapply_aspectcan be removed fromax.draw.Before
Show:
boo.png:
After
PR Checklist