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

FIX: pass renderer through `_auto_legend_data` by rcomer · Pull Request #29317 · matplotlib/matplotlib · GitHub

Repository navigation

FIX: pass renderer through _auto_legend_data - #29317

Merged
timhoffm merged 1 commit into
matplotlib:mainfrom
rcomer:eps-legend-annotate
Dec 16, 2024
Merged

timhoffm merged 1 commit into
matplotlib:mainfrom
rcomer:eps-legend-annotate

Conversation

rcomer commented Dec 15, 2024

Copy link
Copy Markdown
Member

PR summary

Fixes #29301.

The problem was that FigureCanvasPS._print_figure essentially got into a loop of calling itself: somewhere within figure.draw we needed to call figure._get_renderer in order to calculate the annotation window extent and therefore the legend position. _get_renderer ultimately calls FigureCanvasPS._print_figure again. I haven't quite followed why, but by the time we get to the end of FigureCanvasPS._print_figure, _ps_writer which should contain all the information about the artists is empty.

We can avoid all this by just passing the renderer we already have hold of to get_window_extent.

PR checklist

rcomer added this to the v3.10.1 milestone Dec 15, 2024
rcomer added the PR: bugfix Pull requests that fix identified bugs label Dec 15, 2024

oscargus 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

Nice test! (I would have went with an image test, but this is clearly better!)

timhoffm merged commit 3aebcb7 into matplotlib:main Dec 16, 2024
meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull request Dec 16, 2024
rcomer deleted the eps-legend-annotate branch December 16, 2024 09:43
rcomer added a commit that referenced this pull request Dec 16, 2024
…317-on-v3.10.x

Backport PR #29317 on branch v3.10.x (FIX: pass renderer through `_auto_legend_data`)
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

Labels

PR: bugfix Pull requests that fix identified bugs topic: legend

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Blank EPS output with legend and annotate

3 participants


Back | FazBrowse Home | New Git URL