Skip to content

Fix get_tightbbox to include axis labels in 3D axes#31573

Open
Sathush504 wants to merge 2 commits into
matplotlib:mainfrom
Sathush504:3d-tightbbox-axis-labels
Open

Fix get_tightbbox to include axis labels in 3D axes#31573
Sathush504 wants to merge 2 commits into
matplotlib:mainfrom
Sathush504:3d-tightbbox-axis-labels

Conversation

@Sathush504
Copy link
Copy Markdown

@Sathush504 Sathush504 commented Apr 26, 2026

savefig(bbox_inches='tight') was clipping zlabel and xlabel on 3D axes because Axes3D.get_tightbbox() did not include axis label bounding boxes in its calculation. On 2D axes the superclass handles this correctly.

Fixes #31568
Related to #28117

PR summary

AI Disclosure

PR checklist

savefig(bbox_inches='tight') was clipping zlabel and xlabel on 3D axes
because Axes3D.get_tightbbox() did not include axis label bounding boxes
in its calculation. On 2D axes the superclass handles this correctly.

Fixes matplotlib#31568
Related to matplotlib#28117
@beelauuu
Copy link
Copy Markdown
Contributor

You should run the linter and recommit.

@Sathush504
Copy link
Copy Markdown
Author

You should run the linter and recommit.

Fixed. ruff reported two issues (missing blank line and no newline at end of file), both resolved and pushed.

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.

[Bug]: savefig(bbox_inches='tight') clips axis labels on 3D axes

2 participants