Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Workaround Text3D breaking tight_layout() #12693

Merged

Conversation

timhoffm
Copy link
Member

@timhoffm timhoffm commented Nov 1, 2018

PR Summary

Closes #12687.

Text3D used the get_tightbbox() calculation of Text, which is not valid for 3D. This patch reimplements get_tightbbox() for Text3D.

For now, we just exclude the text from the layout. This is better than breaking the layout. In the long run, it would be good to get the transform right so that the text is included in the layout calculation.

Note: Axis3D currently does the same.

def get_tightbbox(self, renderer):

@jklymak
Copy link
Member

jklymak commented Nov 1, 2018

This seems fine to me, but a 3-D expert should maybe weigh in?

@timhoffm timhoffm added this to the v3.0.x milestone Nov 1, 2018
@WeatherGod
Copy link
Member

Can we add a test for this, please?

Copy link
Member

@tacaswell tacaswell left a comment

Choose a reason for hiding this comment

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

Blocking on @WeatherGod 's request for a test.

@timhoffm timhoffm force-pushed the workaround-text3d-breaks-tightlayout branch from a543c4c to 1a5a2cb Compare November 4, 2018 11:36
@timhoffm
Copy link
Member Author

timhoffm commented Nov 4, 2018

Added a test that checks that the order of text() and tight_layout() does not matter. IMO this is the best we can test for. The test fails on master and passes here.

@timhoffm timhoffm dismissed tacaswell’s stale review November 4, 2018 18:44

Dismissing since the test was added.

@WeatherGod WeatherGod merged commit 4d9d142 into matplotlib:master Nov 5, 2018
meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull request Nov 5, 2018
@timhoffm timhoffm deleted the workaround-text3d-breaks-tightlayout branch November 5, 2018 18:30
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.

None yet

5 participants