Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
Factor out handling of missing spines in alignment calculations.#28313
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
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.
Take or leave my comments. You can self-merge.
lib/matplotlib/axis.py Outdated
@@ -2400,34 +2400,19 @@ def _update_label_position(self, renderer): | |||
# get bounding boxes for this axis and any siblings | |||
# that have been set by `fig.align_xlabels()` | |||
bboxes, bboxes2 = self._get_tick_boxes_siblings(renderer=renderer) | |||
ax = self.axes |
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.
This is only extracted to make l.2409 / l.2414 shorter. I would not do that because it separates definition and usage and thereby results in more state and thus cognitive load.
I slightly prefer to either leave this in placeself.axes.spines.get("bottom", self.axes)
- or if that's reads too cumbersome, define it right before usage in each if branch.
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 the repetition of self.axes reads a bit cumbersome here, but sure, I put it back. Ditto below.
lib/matplotlib/axis.py Outdated
@@ -2641,33 +2626,19 @@ def _update_label_position(self, renderer): | |||
# get bounding boxes for this axis and any siblings | |||
# that have been set by `fig.align_ylabels()` | |||
bboxes, bboxes2 = self._get_tick_boxes_siblings(renderer=renderer) | |||
ax = self.axes |
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.
As above.
... by using spines.get.Note that for an Axes, get_window_extent (with or without the rendererargument) is always equal to ax.bbox; the refactoring also makes thatsymmetry clearer.
2834da1
intomatplotlib:mainUh oh!
There was an error while loading.Please reload this page.
... by using spines.get.
Note that for an Axes, get_window_extent (with or without the renderer argument) is always equal to ax.bbox; the refactoring also makes that symmetry clearer.
Noted while looking at#28300.
PR summary
PR checklist