Skip to content

FIX: check if axes is off page before repositioning title - #18288

Merged
timhoffm merged 3 commits into
matplotlib:masterfrom
jklymak:fix-check-title-off-page
Aug 19, 2020
Merged

timhoffm merged 3 commits into
matplotlib:masterfrom
jklymak:fix-check-title-off-page

Conversation

@jklymak

@jklymak jklymak commented Aug 18, 2020 •

Copy link
Copy Markdown
Member

PR Summary

Closes #18283

We now automatically place the title to avoid decorators on the x axis (particuarly if the axis is at the top). However if the whole axes is cropped due to a bbox_inches=extent call, then the title still gets placed at a default y=0. This change checks if the top is in the figure, and if not, then it doesn't auto position the title.

PR Checklist

  • Has Pytest style unit tests
  • Code is Flake 8 compliant
  • New features are documented, with examples if plot related
  • Documentation is sphinx and numpydoc compliant
  • Added an entry to doc/users/next_whats_new/ if major new feature (follow instructions in README.rst there)
  • Documented in doc/api/next_api_changes/* if API changed in a backward-incompatible way

@jklymak jklymak added the topic: geometry manager LayoutEngine, Constrained layout, Tight layout label Aug 18, 2020
@jklymak jklymak added this to the v3.3.2 milestone Aug 18, 2020
@jklymak

jklymak commented Aug 18, 2020

Copy link
Copy Markdown
Member Author

yeeesh, why am I getting flake8 complaints for a file I didn't edit?

@tacaswell

Copy link
Copy Markdown
Member

It looks like something changed in the flake8 incantation?

@@ -1,6 +1,5 @@
from io import BytesIO
import pickle
import platform

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This is just to make flake8 happy - not part of this PR, but flake8 now seems to check all files, not just modified.

Comment thread lib/matplotlib/tests/test_axes.py Resolved
@jklymak
jklymak force-pushed the fix-check-title-off-page branch from 9e8acd6 to a9ac3d9 Compare August 18, 2020 21:48
@timhoffm
timhoffm merged commit ce6ac2d into matplotlib:master Aug 19, 2020
meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull request Aug 19, 2020
timhoffm added a commit that referenced this pull request Aug 19, 2020
…288-on-v3.3.x

Backport PR #18288 on branch v3.3.x (FIX: check if axes is off page before repositioning title)
SidharthBansal pushed a commit to SidharthBansal/matplotlib that referenced this pull request Aug 20, 2020
…page

FIX: check if axes is off page before repositioning title
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

topic: geometry manager LayoutEngine, Constrained layout, Tight layout

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Automatic title placement wrong if parent axes is off the page

4 participants