Skip to content

Commit 2e71850

Browse files
author
J. Scott Berg
committed
_update_patch_limits: use a simpler method to select the vertices to include
1 parent ad31040 commit 2e71850

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

lib/matplotlib/axes/_base.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -2095,10 +2095,9 @@ def _update_patch_limits(self, patch):
20952095
if (isinstance(patch, mpatches.Rectangle) and
20962096
((not patch.get_width()) and (not patch.get_height()))):
20972097
return
2098-
vertices = np.array([v for s in patch.get_path().iter_segments()
2099-
if s[1] != mpath.Path.CLOSEPOLY
2100-
and s[1] != mpath.Path.STOP
2101-
for v in s[0]]).reshape([-1, 2])
2098+
p = patch.get_path()
2099+
vertices = p.vertices if p.codes is None else p.vertices[np.isin(
2100+
p.codes, (mpath.Path.CLOSEPOLY, mpath.Path.STOP), invert=True)]
21022101
if vertices.size > 0:
21032102
xys = patch.get_patch_transform().transform(vertices)
21042103
if patch.get_data_transform() != self.transData:

0 commit comments

Comments
 (0)