Skip to content

Commit 8d2f28b

Browse files
committed
BUG : fixes broadcast errors with np 1.9
fixes some of the issues raised in #3186
1 parent 8ebc30c commit 8d2f28b

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

lib/matplotlib/tri/trirefine.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,8 @@ def refine_triangulation(self, return_tri_index=False, subdiv=3):
117117
found_index = - np.ones(refi_npts, dtype=np.int32)
118118
tri_mask = self._triangulation.mask
119119
if tri_mask is None:
120-
found_index[refi_triangles] = np.repeat(ancestors, 3)
120+
found_index[refi_triangles] = np.repeat(ancestors,
121+
3).reshape(-1, 3)
121122
else:
122123
# There is a subtlety here: we want to avoid whenever possible
123124
# that refined points container is a masked triangle (which
@@ -126,9 +127,11 @@ def refine_triangulation(self, return_tri_index=False, subdiv=3):
126127
# then overwrite it with unmasked ancestor numbers.
127128
ancestor_mask = tri_mask[ancestors]
128129
found_index[refi_triangles[ancestor_mask, :]
129-
] = np.repeat(ancestors[ancestor_mask], 3)
130+
] = np.repeat(ancestors[ancestor_mask],
131+
3).reshape(-1, 3)
130132
found_index[refi_triangles[~ancestor_mask, :]
131-
] = np.repeat(ancestors[~ancestor_mask], 3)
133+
] = np.repeat(ancestors[~ancestor_mask],
134+
3).reshape(-1, 3)
132135
return refi_triangulation, found_index
133136
else:
134137
return refi_triangulation

0 commit comments

Comments
 (0)