FIX/ENH: include text in ax.get_tightbbox#10678
FIX/ENH: include text in ax.get_tightbbox#10678jklymak wants to merge 1 commit intomatplotlib:masterfrom
Conversation
efiring
left a comment
There was a problem hiding this comment.
Looks good, subject to tests passing.
|
OK, actually, I'm a little confused now about the API for matplotlib/lib/matplotlib/axes/_base.py Line 4094 in 4f5715a It says that it will the matplotlib/lib/matplotlib/backend_bases.py Line 2190 in 4f5715a where all the artists are iterated through and added to the bbox. I guess I don't see why this functionality isn't moved into Pros: are that dangling artists get counted for layout easily. Cons: its possible that the user would want the layout to ignore some artists when making a layout. Comments? |
|
Closing in lieu of #10682, which I think is a more comprehensive solution. |
PR Summary
If text overflows an axes,
ax.get_tightbboxdoesn't include it.Note this doesn't require
constrained_layoutto be a problem.Saving withEDIT: This wasn't true -bbox_inches='tight'will also cut the extra text off..bbox_inches='tight'renders the figure and then figures out the bbox. But, I don't see why we wouldn't include over-spilling text in the tight bbox for an axes.Before
After
PR Checklist