Skip to content

Commit 030d227

Browse files
committed
Fix tightbbox label collapse using new Bbox instead of mutation, update baseline
1 parent 1d47ffb commit 030d227

2 files changed

Lines changed: 4 additions & 6 deletions

File tree

lib/mpl_toolkits/mplot3d/axis3d.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -727,13 +727,11 @@ def get_tightbbox(self, renderer=None, *, for_layout_only=False):
727727
if for_layout_only:
728728
angle = self.label.get_rotation()
729729
if abs(angle % 180) < 45: # label is roughly horizontal
730-
if bb.height > 0:
731-
bb.y0 = (bb.y0 + bb.y1) / 2 - 0.5
732-
bb.y1 = bb.y0 + 1.0
730+
bb = mtransforms.Bbox([[bb.x0, (bb.y0 + bb.y1) / 2 - 0.5],
731+
[bb.x1, (bb.y0 + bb.y1) / 2 + 0.5]])
733732
else: # label is roughly vertical
734-
if bb.width > 0:
735-
bb.x0 = (bb.x0 + bb.x1) / 2 - 0.5
736-
bb.x1 = bb.x0 + 1.0
733+
bb = mtransforms.Bbox([[(bb.x0 + bb.x1) / 2 - 0.5, bb.y0],
734+
[(bb.x0 + bb.x1) / 2 + 0.5, bb.y1]])
737735
other.append(bb)
738736

739737
return mtransforms.Bbox.union([*bb_1, *bb_2, *other])
314 Bytes
Loading

0 commit comments

Comments
 (0)