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

Skip to content

Commit 8b4d7d7

Browse files
Merge branch 'master' of https://github.com/matplotlib/matplotlib into file_name_made_more_understandable
2 parents 45252f1 + 98dff87 commit 8b4d7d7

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

lib/matplotlib/collections.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ def get_datalim(self, transData):
219219
# get_path_collection_extents handles nan but not masked arrays
220220

221221
if len(paths) and len(offsets):
222-
if transform.contains_branch(transData):
222+
if any(transform.contains_branch_seperately(transData)):
223223
# collections that are just in data units (like quiver)
224224
# can properly have the axes limits set by their shape +
225225
# offset. LineCollections that have no offsets can

lib/matplotlib/patches.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -720,7 +720,8 @@ def __init__(self, xy, width, height, angle=0.0, **kwargs):
720720
Parameters
721721
----------
722722
xy : (float, float)
723-
The bottom and left rectangle coordinates
723+
The rectangle extends from xy[0] to xy[0] + width in
724+
x-direction and from xy[1] to xy[1] + height in y-direction.
724725
width : float
725726
Rectangle width
726727
height : float

lib/matplotlib/tests/test_collections.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -616,3 +616,17 @@ def test_collection_set_verts_array():
616616
for ap, lp in zip(col_arr._paths, col_list._paths):
617617
assert np.array_equal(ap._vertices, lp._vertices)
618618
assert np.array_equal(ap._codes, lp._codes)
619+
620+
621+
def test_blended_collection_autolim():
622+
a = [1, 2, 4]
623+
height = .2
624+
625+
xy_pairs = np.column_stack([np.repeat(a, 2), np.tile([0, height], len(a))])
626+
line_segs = xy_pairs.reshape([len(a), 2, 2])
627+
628+
f, ax = plt.subplots()
629+
trans = mtransforms.blended_transform_factory(ax.transData, ax.transAxes)
630+
ax.add_collection(LineCollection(line_segs, transform=trans))
631+
ax.autoscale_view(scalex=True, scaley=False)
632+
np.testing.assert_allclose(ax.get_xlim(), [1., 4.])

0 commit comments

Comments
 (0)