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

Skip to content

Commit a6f119f

Browse files
committed
Small cleanup to StepPatch._update_path.
- No need to explicitly convert to arrays in `codes`; `concatenate` will do that for us. - We only need to compute the Path once at the end of the loop (all other iterations are just thrown away). - Both `verts` and `codes` are being concatenated along their first axis, so using different stackers (`vstack`/`hstack`) just hides that symmetry.
1 parent 02af61b commit a6f119f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/matplotlib/patches.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1009,8 +1009,8 @@ def _update_path(self):
10091009
else:
10101010
xy = np.column_stack([y, x])
10111011
verts.append(xy)
1012-
codes.append(np.array([Path.MOVETO] + [Path.LINETO]*(len(xy)-1)))
1013-
self._path = Path(np.vstack(verts), np.hstack(codes))
1012+
codes.append([Path.MOVETO] + [Path.LINETO]*(len(xy)-1))
1013+
self._path = Path(np.concatenate(verts), np.concatenate(codes))
10141014

10151015
def get_data(self):
10161016
"""Get `.StepPatch` values, edges and baseline as namedtuple."""

0 commit comments

Comments
 (0)