Skip to content

Commit e94ee0b

Browse files
committed
Merge remote-tracking branch 'matplotlib/v2.1.x'
Conflicts: lib/matplotlib/tests/test_image.py - new test vs whitespace at end of file
2 parents bcf269e + 58883c5 commit e94ee0b

File tree

3 files changed

+21
-6
lines changed

3 files changed

+21
-6
lines changed

doc/_templates/autofunctions.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,16 @@
22
{{ fullname | escape | underline }}
33

44

5-
.. currentmodule:: {{ fullname }}
5+
.. automodule:: {{ fullname }}
6+
:no-members:
67

78
{% block functions %}
89
{% if functions %}
910

1011
Functions
1112
---------
1213

13-
.. autosummary::
14+
.. autosummary::
1415
:template: autosummary.rst
1516
:toctree:
1617
{% for item in functions %}{% if item not in ['plotting', 'colormaps'] %}

lib/matplotlib/image.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -368,10 +368,14 @@ def _make_image(self, A, in_bbox, out_bbox, clip_bbox, magnification=1.0,
368368
scaled_dtype = A.dtype
369369
else:
370370
scaled_dtype = np.float32
371-
# old versions of numpy do not work with `np.nammin`
372-
# and `np.nanmax` as inputs
373-
a_min = np.ma.min(A).astype(scaled_dtype)
374-
a_max = np.ma.max(A).astype(scaled_dtype)
371+
372+
a_min = A.min()
373+
if a_min is np.ma.masked:
374+
a_min, a_max = 0, 1 # all masked, so values don't matter
375+
else:
376+
a_min = a_min.astype(scaled_dtype)
377+
a_max = A.max().astype(scaled_dtype)
378+
375379
# scale the input data to [.1, .9]. The Agg
376380
# interpolators clip to [0, 1] internally, use a
377381
# smaller input scale to identify which of the

lib/matplotlib/tests/test_image.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -835,3 +835,13 @@ def test_imshow_deprecated_interd_warn():
835835
with warnings.catch_warnings(record=True) as warns:
836836
getattr(im, k)
837837
assert len(warns) == 1
838+
839+
840+
def test_full_invalid():
841+
x = np.ones((10, 10))
842+
x[:] = np.nan
843+
844+
f, ax = plt.subplots()
845+
ax.imshow(x)
846+
847+
f.canvas.draw()

0 commit comments

Comments
 (0)