8000 Merge pull request #26661 from meeseeksmachine/auto-backport-of-pr-26… · matplotlib/matplotlib@48659c1 · GitHub
[go: up one dir, main page]

Skip to content

Commit 48659c1

Browse files
authored
Merge pull request #26661 from meeseeksmachine/auto-backport-of-pr-26566-on-v3.8.x
Backport PR #26566 on branch v3.8.x (MAINT: Numpy 2.0 deprecations for row_stack and in1d)
2 parents d5a2ff0 + 1842ff5 commit 48659c1

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
@@ -3677,7 +3677,7 @@ def apply_mask(arrays, mask):
36773677
# elow, ehigh = np.broadcast_to(...)
36783678
# return dep - elow * ~lolims, dep + ehigh * ~uplims
36793679
# except that broadcast_to would strip units.
3680-
low, high = dep + np.row_stack([-(1 - lolims), 1 - uplims]) * err
3680+
low, high = dep + np.vstack([-(1 - lolims), 1 - uplims]) * err
36813681
barcols.append(lines_func(
36823682
*apply_mask([indep, low, high], everymask), **eb_lines_style))
36833683
if self.name == "polar" and dep_axis == "x":
@@ -5485,8 +5485,8 @@ def get_interp_point(idx):
54855485
collection = mcoll.PolyCollection(polys, **kwargs)
54865486

54875487
# now update the datalim and autoscale
5488-
pts = np.row_stack([np.column_stack([ind[where], dep1[where]]),
5489-
np.column_stack([ind[where], dep2[where]])])
5488+
pts = np.vstack([np.hstack([ind[where, None], dep1[where, None]]),
5489+
np.hstack([ind[where, None], dep2[where, None]])])
54905490
if ind_dir == "y":
54915491
pts = pts[:, ::-1]
54925492

lib/matplotlib/axes/_base.py

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

24122412
if len(vertices):
2413-
vertices = np.row_stack(vertices)
2413+
vertices = np.vstack(vertices)
24142414

24152415
patch_trf = patch.get_transform()
24162416
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