Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c31c4f6

Browse files
committed
FIX: finish transform
1 parent 10bd472 commit c31c4f6

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

lib/matplotlib/collections.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,9 @@ def get_datalim(self, transData):
227227
# (i.e. like scatter). We can't uniquely set limits based on
228228
# those shapes, so we just set the limits based on their
229229
# location.
230+
# Finish the transform:
231+
offsets = transOffset.transform(offsets)
232+
offsets = transData.inverted().transform(offsets)
230233
offsets = np.ma.masked_invalid(offsets)
231234
extents = [[np.min(offsets[:, 0]), np.min(offsets[:, 1])],
232235
[np.max(offsets[:, 0]), np.max(offsets[:, 1])]]

lib/matplotlib/tests/test_collections.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -428,11 +428,11 @@ def test_quiver_limits():
428428

429429
def test_barb_limits():
430430
ax = plt.axes()
431-
x = np.linspace(-5, 10, 20) + 25
432-
y = np.linspace(-2, 4, 10) + 32
431+
x = np.linspace(-5, 10, 20)
432+
y = np.linspace(-2, 4, 10)
433433
y, x = np.meshgrid(y, x)
434-
# trans = mtransforms.Affine2D().translate(25, 32) + ax.transData
435-
plt.barbs(x, y, np.sin(x), np.cos(y))
434+
trans = mtransforms.Affine2D().translate(25, 32) + ax.transData
435+
plt.barbs(x, y, np.sin(x), np.cos(y), transform=trans)
436436
# The calculated bounds are approximately the bounds of the original data,
437437
# this is because the entire path is taken into account when updating the
438438
# datalim.

0 commit comments

Comments
 (0)