X Tutup
Skip to content

imshow should silence warnings on invalid values, at least when masked #7746

@anntzer

Description

@anntzer

mpl 2.0rc2, numpy 1.11.3

An invalid value, whether masked or not, leads to two RuntimeWarnings:

imshow(np.ma.masked_invalid([[1, 2], [3, np.nan]]))

and

imshow([[1, 2], [3, np.nan]])

give

/usr/lib/python3.5/site-packages/matplotlib/image.py:371: RuntimeWarning: invalid value encountered in less
  rgba[..., 1] = A < 0  # under data
/usr/lib/python3.5/site-packages/matplotlib/image.py:372: RuntimeWarning: invalid value encountered in greater
  rgba[..., 2] = A > 1  # over data

I would argue that a warning should be raised in neither case, given that such inputs are supposed to be supported (http://matplotlib.org/examples/pylab_examples/image_masked.html, #6069).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      X Tutup