From 65c7d0b8f305e12872ec3e3da24d52cb5b4c3333 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Fri, 4 Aug 2023 20:36:24 -0400 Subject: [PATCH] Backport PR #26458: Remove soon to be deprecated nan/inf aliases --- lib/matplotlib/tests/test_axes.py | 6 +++--- lib/matplotlib/tests/test_colors.py | 6 +++--- lib/matplotlib/tests/test_image.py | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/matplotlib/tests/test_axes.py b/lib/matplotlib/tests/test_axes.py index cf33d31c6f77..c593a9cc54e2 100644 --- a/lib/matplotlib/tests/test_axes.py +++ b/lib/matplotlib/tests/test_axes.py @@ -1401,7 +1401,7 @@ def test_pcolorargs(): ax.pcolormesh(x, y, Z[:-1, :-1], shading="gouraud") with pytest.raises(TypeError): ax.pcolormesh(X, Y, Z[:-1, :-1], shading="gouraud") - x[0] = np.NaN + x[0] = np.nan with pytest.raises(ValueError): ax.pcolormesh(x, y, Z[:-1, :-1]) with np.errstate(invalid='ignore'): @@ -7232,7 +7232,7 @@ def test_limits_after_scroll_zoom(): def test_gettightbbox_ignore_nan(): fig, ax = plt.subplots() remove_ticks_and_titles(fig) - ax.text(np.NaN, 1, 'Boo') + ax.text(np.nan, 1, 'Boo') renderer = fig.canvas.get_renderer() np.testing.assert_allclose(ax.get_tightbbox(renderer).width, 496) @@ -8390,7 +8390,7 @@ def test_bar_leading_nan(): barheights = np.array([0.5, 1.5, 2.0]) barstarts = np.array([0.77]*3) - barx[0] = np.NaN + barx[0] = np.nan fig, ax = plt.subplots() diff --git a/lib/matplotlib/tests/test_colors.py b/lib/matplotlib/tests/test_colors.py index e40796caa7cc..367fd6ce567f 100644 --- a/lib/matplotlib/tests/test_colors.py +++ b/lib/matplotlib/tests/test_colors.py @@ -338,7 +338,7 @@ def test_BoundaryNorm(): # Masked arrays boundaries = [0, 1.1, 2.2] - vals = np.ma.masked_invalid([-1., np.NaN, 0, 1.4, 9]) + vals = np.ma.masked_invalid([-1., np.nan, 0, 1.4, 9]) # Without interpolation ncolors = len(boundaries) - 1 @@ -352,9 +352,9 @@ def test_BoundaryNorm(): assert_array_equal(bn(vals), expected) # Non-trivial masked arrays - vals = np.ma.masked_invalid([np.Inf, np.NaN]) + vals = np.ma.masked_invalid([np.inf, np.nan]) assert np.all(bn(vals).mask) - vals = np.ma.masked_invalid([np.Inf]) + vals = np.ma.masked_invalid([np.inf]) assert np.all(bn(vals).mask) # Incompatible extend and clip diff --git a/lib/matplotlib/tests/test_image.py b/lib/matplotlib/tests/test_image.py index 9198c2b91994..9120d146ec95 100644 --- a/lib/matplotlib/tests/test_image.py +++ b/lib/matplotlib/tests/test_image.py @@ -1374,7 +1374,7 @@ def test_rgba_antialias(): aa[:, int(N/2):] = a[:, int(N/2):] # set some over/unders and NaNs - aa[20:50, 20:50] = np.NaN + aa[20:50, 20:50] = np.nan aa[70:90, 70:90] = 1e6 aa[70:90, 20:30] = -1e6 aa[70:90, 195:215] = 1e6 pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy