Skip to content

Commit

Permalink
Backport PR matplotlib#26458: Remove soon to be deprecated nan/inf al…
Browse files Browse the repository at this point in the history
…iases
  • Loading branch information
QuLogic authored and meeseeksmachine committed Aug 5, 2023
1 parent 314edc6 commit 65c7d0b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions lib/matplotlib/tests/test_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'):
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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()

Expand Down
6 changes: 3 additions & 3 deletions lib/matplotlib/tests/test_colors.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/matplotlib/tests/test_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 65c7d0b

Please sign in to comment.