diff --git a/lib/matplotlib/tri/triinterpolate.py b/lib/matplotlib/tri/triinterpolate.py index 47a02b6cc820..998c01881208 100644 --- a/lib/matplotlib/tri/triinterpolate.py +++ b/lib/matplotlib/tri/triinterpolate.py @@ -462,9 +462,9 @@ def _interpolate_single_key(self, return_key, tri_index, x, y): dzdx = self._ReferenceElement.get_function_derivatives( alpha, J, ecc, dof) if return_key == 'dzdx': - return dzdx[:, 0] + return dzdx[:, 0, 0] else: - return dzdx[:, 1] + return dzdx[:, 1, 0] else: raise ValueError("Invalid return_key: " + return_key) diff --git a/lib/matplotlib/tri/trirefine.py b/lib/matplotlib/tri/trirefine.py index 70a1166e736f..ae2f257a1f5e 100644 --- a/lib/matplotlib/tri/trirefine.py +++ b/lib/matplotlib/tri/trirefine.py @@ -117,7 +117,8 @@ def refine_triangulation(self, return_tri_index=False, subdiv=3): found_index = - np.ones(refi_npts, dtype=np.int32) tri_mask = self._triangulation.mask if tri_mask is None: - found_index[refi_triangles] = np.repeat(ancestors, 3) + found_index[refi_triangles] = np.repeat(ancestors, + 3).reshape(-1, 3) else: # There is a subtlety here: we want to avoid whenever possible # that refined points container is a masked triangle (which @@ -126,9 +127,11 @@ def refine_triangulation(self, return_tri_index=False, subdiv=3): # then overwrite it with unmasked ancestor numbers. ancestor_mask = tri_mask[ancestors] found_index[refi_triangles[ancestor_mask, :] - ] = np.repeat(ancestors[ancestor_mask], 3) + ] = np.repeat(ancestors[ancestor_mask], + 3).reshape(-1, 3) found_index[refi_triangles[~ancestor_mask, :] - ] = np.repeat(ancestors[~ancestor_mask], 3) + ] = np.repeat(ancestors[~ancestor_mask], + 3).reshape(-1, 3) return refi_triangulation, found_index else: return refi_triangulation