FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Factor out handling of missing spines in alignment calculations. by anntzer · Pull Request #28313 · matplotlib/matplotlib · GitHub

Repository navigation

Factor out handling of missing spines in alignment calculations. - #28313

Merged
timhoffm merged 1 commit into
matplotlib:mainfrom
anntzer:missing-spine
May 27, 2024
Merged

timhoffm merged 1 commit into
matplotlib:mainfrom
anntzer:missing-spine

Conversation

anntzer commented May 27, 2024

Copy link
Copy Markdown
Contributor

... 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

This comment was marked as outdated.

timhoffm left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Take or leave my comments. You can self-merge.

Comment thread lib/matplotlib/axis.py Outdated
# that have been set by `fig.align_xlabels()`
bboxes, bboxes2 = self._get_tick_boxes_siblings(renderer=renderer)

ax = self.axes

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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 place self.axes.spines.get("bottom", self.axes) - or if that's reads too cumbersome, define it right before usage in each if branch.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I think the repetition of self.axes reads a bit cumbersome here, but sure, I put it back. Ditto below.

Comment thread lib/matplotlib/axis.py Outdated
# 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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

As above.

... 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.
timhoffm added this to the v3.10.0 milestone May 27, 2024
timhoffm merged commit 2834da1 into matplotlib:main May 27, 2024
anntzer deleted the missing-spine branch May 27, 2024 18:26
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants


Back | FazBrowse Home | New Git URL