-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
FIX: errors in get_position changes #12363
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
FIX: errors in get_position changes #12363
Conversation
Maybe this is a good place to add a test for the failing usecase? |
New test fails master, passes this PR and was the root of the problem.... |
59a994b
to
a5e6667
Compare
Please rebase. #12366 is in and should fix the failing CI. |
a5e6667
to
0ce489c
Compare
...rebased |
flake8 says
|
0ce489c
to
1da1c35
Compare
Fixed flake8. I'd actually be in favour of adding an Exception for the trailing whitespace error. |
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.
everything else looks good, just have a comment about a code alignment.
lib/matplotlib/figure.py
Outdated
@@ -2298,7 +2298,8 @@ def get_tightbbox(self, renderer, bbox_extra_artists=None): | |||
|
|||
for ax in self.axes: | |||
if ax.get_visible(): | |||
bb.append(ax.get_tightbbox(renderer, bbox_extra_artists)) | |||
bb.append(ax.get_tightbbox(renderer, | |||
bbox_extra_artists=bbox_extra_artists)) |
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.
The alignment of this keyword argument makes me think it is for the append, not the get_tightbbox(), but even that looks wonky. Which PEP8 alignment rule is this?
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.
I just did two-tab (8-space) indentation - I don't think it'll fit on one line, though I can check
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.
It will not, nor will it work with aligning to the correct opening parenthesis, but you can do this:
bb.append(
ax.get_tightbbox(renderer,
bbox_extra_artists=bbox_extra_artists))
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.
Ummm, OK, but really the 8-space indent is allowed by PEP8, and in this case I think looks best:
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.
I'm meant "will not fit", not anything about whether it's in PEP8.
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.
That PEP8 link uses 4-space indent for continuation lines; it's only if there's ambiguity that double indent is used (but keep in mind there are no nested function calls in those examples.)
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.
I think a list comprehension would be more readable anyway.
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.
OK, list comprehension is bearable.
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.
Uh, I think (hope?) @timhoffm meant something like
bbox.extend(
ax.get_tightbbox(renderer, bbox_extra_artists=bbox_extra_artists)
for ax in self.axes if ax.get_visible())
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.
Fine
for ax in self.parasites] | ||
bbs.append(super().get_tightbbox(renderer, call_axes_locator)) | ||
bbs.append(super().get_tightbbox(renderer, | ||
call_axes_locator=call_axes_locator)) |
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.
similar issue here, the alignment of the keyword argument is wonky.
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.
Fixed
a518ddf
to
d4c7069
Compare
TST: add image grid test
d4c7069
to
78db75f
Compare
@@ -327,9 +327,10 @@ def _remove_method(h): | |||
return ax2 | |||
|
|||
def get_tightbbox(self, renderer, call_axes_locator=True): | |||
bbs = [ax.get_tightbbox(renderer, call_axes_locator) | |||
bbs = [ax.get_tightbbox(renderer, call_axes_locator=call_axes_locator) |
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.
I don't see how this change is needed? (doesn't hurt, but still?)
Owee, I'm MrMeeseeks, Look at me. There seem to be a conflict, please backport manually. Here are approximate instructions:
And apply the correct labels and milestones. Congratulation you did some good work ! Hopefully your backport PR will be tested by the continuous integration and merged soon! If these instruction are inaccurate, feel free to suggest an improvement. |
…tion-errors FIX: errors in get_position changes
…3.0.x Backport PR #12363 on branch v3.0.x
PR Summary
Closes #12355
This corrects a few mistakes in positioning PRs that were preventing locatable axes from working correctly. It also makes a couple of kwargs explicit rather than positional when we call them.
PR Checklist