8000 adding tests and changing typecasts · matplotlib/matplotlib@da46769 · GitHub
[go: up one dir, main page]

Skip to content

Commit da46769

Browse files
committed
adding tests and changing typecasts
1 parent 9bf681e commit da46769

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

lib/matplotlib/contour.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1452,7 +1452,7 @@ def _contour_args(self, args, kwargs):
14521452
if self.logscale and self.zmin <= 0:
14531453
z = ma.masked_where(z <= 0, z)
14541454
_api.warn_external('Log scale: values of z <= 0 have been masked')
1455-
self.zmin = float(z.min())
1455+
self.zmin = z.min().astype(float)
14561456
self._process_contour_level_args(args, z.dtype)
14571457
return (x, y, z)
14581458

lib/matplotlib/tests/test_contour.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -715,3 +715,9 @@ def test_bool_autolevel():
715715
assert plt.tricontour(x, y, z).levels.tolist() == [.5]
716716
assert plt.tricontourf(x, y, z.tolist()).levels.tolist() == [0, .5, 1]
717717
assert plt.tricontourf(x, y, z).levels.tolist() == [0, .5, 1]
718+
719+
def test_all_nan():
720+
x = np.array([[np.nan, np.nan], [np.nan, np.nan]])
721+
assert_array_almost_equal(plt.contour(x).levels.tolist(),
722+
[-1e-13, -7.5e-14, -5e-14, -2.4e-14, 0.0,
723+
2.4e-14, 5e-14, 7.5e-14, 1e-13])

0 commit comments

Comments
 (0)
0