8000 MAINT: Numpy 2.0 deprecations for row_stack and in1d · ksunden/matplotlib@ef5689f · GitHub
[go: up one dir, main page]

Skip to content

Commit ef5689f

Browse files
committed
MAINT: Numpy 2.0 deprecations for row_stack and in1d
Part of matplotlib#26422, xref numpy/numpy#24445
1 parent db533bf commit ef5689f

File tree

7 files changed

+12
-12
lines changed

7 files changed

+12
-12
lines changed

lib/matplotlib/axes/_axes.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3674,7 +3674,7 @@ def apply_mask(arrays, mask):
36743674
# elow, ehigh = np.broadcast_to(...)
36753675
# return dep - elow * ~lolims, dep + ehigh * ~uplims
36763676
# except that broadcast_to would strip units.
3677-
low, high = dep + np.row_stack([-(1 - lolims), 1 - uplims]) * err
3677+
low, high = dep + np.vstack([-(1 - lolims), 1 - uplims]) * err
36783678
barcols.append(lines_func(
36793679
*apply_mask([indep, low, high], everymask), **eb_lines_style))
36803680
if self.name == "polar" and dep_axis == "x":
@@ -5471,8 +5471,8 @@ def get_interp_point(idx):
54715471
collection = mcoll.PolyCollection(polys, **kwargs)
54725472

54735473
# now update the datalim and autoscale
5474-
pts = np.row_stack([np.column_stack([ind[where], dep1[where]]),
5475-
np.column_stack([ind[where], dep2[where]])])
5474+
pts = np.vstack([np.column_stack([ind[where], dep1[where]]),
5475+
np.column_stack([ind[where], dep2[where]])])
54765476
if ind_dir == "y":
54775477
pts = pts[:, ::-1]
54785478

lib/matplotlib/axes/_base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2403,7 +2403,7 @@ def _update_patch_limits(self, patch):
24032403
vertices.append(curve([0, *dzeros, 1]))
24042404

24052405
if len(vertices):
2406-
vertices = np.row_stack(vertices)
2406+
vertices = np.vstack(vertices)
24072407

24082408
patch_trf = patch.get_transform()
24092409
updatex, updatey = patch_trf.contains_branch_seperately(self.transData)

lib/matplotlib/contour.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -511,13 +511,13 @@ def calc_label_rot_and_inline(self, slc, ind, lw, lc=None, spacing=5):
511511
if closed:
512512
# This will remove contour if shorter than label
513513
if all(i != -1 for i in I):
514-
nlc.append(np.row_stack([xy2, lc[I[1]:I[0]+1], xy1]))
514+
nlc.append(np.vstack([xy2, lc[I[1]:I[0]+1], xy1]))
515515
else:
516516
# These will remove pieces of contour if they have length zero
517517
if I[0] != -1:
518-
nlc.append(np.row_stack([lc[:I[0]+1], xy1]))
518+
nlc.append(np.vstack([lc[:I[0]+1], xy1]))
519519
if I[1] != -1:
520-
nlc.append(np.row_stack([xy2, lc[I[1]:]]))
520+
nlc.append(np.vstack([xy2, lc[I[1]:]]))
521521

522522
# The current implementation removes contours completely
523523
# covered by labels. Uncomment line below to keep

lib/matplotlib/projections/polar.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ def transform_path_non_affine(self, path):
121121
codes.extend(arc.codes[1:])
122122
else: # Interpolate.
123123
trs = cbook.simple_linear_interpolation(
124-
np.row_stack([(last_t, last_r), trs]),
124+
np.vstack([(last_t, last_r), trs]),
125125
path._interpolation_steps)[1:]
126126
xys.extend(self.transform_non_affine(trs))
127127
codes.extend([Path.LINETO] * len(trs))

lib/matplotlib/stackplot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def stackplot(axes, x, *args,
6868
stacked area plot.
6969
"""
7070

71-
y = np.row_stack(args)
71+
y = np.vstack(args)
7272

7373
labels = iter(labels)
7474
if colors is not None:

lib/matplotlib/tests/test_triangulation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1035,7 +1035,7 @@ def test_trirefine():
10351035
x_verif, y_verif = np.meshgrid(x_verif, x_verif)
10361036
x_verif = x_verif.ravel()
10371037
y_verif = y_verif.ravel()
1038-
ind1d = np.in1d(np.around(x_verif*(2.5+y_verif), 8),
1038+
ind1d = np.isin(np.around(x_verif*(2.5+y_verif), 8),
10391039
np.around(x_refi*(2.5+y_refi), 8))
10401040
assert_array_equal(ind1d, True)
10411041

lib/mpl_toolkits/mplot3d/art3d.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -942,8 +942,8 @@ def set_zsort(self, zsort):
942942
def get_vector(self, segments3d):
943943
"""Optimize points for projection."""
944944
if len(segments3d):
945-
xs, ys, zs = np.row_stack(segments3d).T
946-
else: # row_stack can't stack zero arrays.
945+
xs, ys, zs = np.vstack(segments3d).T
946+
else: # vstack can't stack zero arrays.
947947
xs, ys, zs = [], [], []
948948
ones = np.ones(len(xs))
949949
self._vec = np.array([xs, ys, zs, ones])

0 commit comments

Comments
 (0)
0