8000 Fix Bbox transformation for skewed Axes. · matplotlib/matplotlib@da0dce4 · GitHub
[go: up one dir, main page]

Skip to content

Commit da0dce4

Browse files
committed
Fix Bbox transformation for skewed Axes.
This involves transforming the upper left and lower right points separately to come up with the combined translated upper right.
1 parent c5cdcbf commit da0dce4

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

lib/matplotlib/transforms.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -517,14 +517,17 @@ def transformed(self, transform):
517517
Return a new :class:`Bbox` object, statically transformed by
518518
the given transform.
519519
"""
520-
return Bbox(transform.transform(self.get_points()))
520+
pts = self.get_points()
521+
ll, ul, lr = transform.transform(np.array([pts[0],
522+
[pts[0, 0], pts[1, 1]], [pts[1, 0], pts[0, 1]]]))
523+
return Bbox([ll, [lr[0], ul[1]]])
521524

522525
def inverse_transformed(self, transform):
523526
"""
524527
Return a new :class:`Bbox` object, statically transformed by
525528
the inverse of the given transform.
526529
"""
527-
return Bbox(transform.inverted().transform(self.get_points()))
530+
return self.transformed(transform.inverted())
528531

529532
coefs = {'C': (0.5, 0.5),
530533
'SW': (0, 0),

0 commit comments

Comments
 (0)
0