Skip to content

Use of np.asscalar in Matplotlib v2.2.3 #13192

Closed
@1313e

Description

@1313e

Bug report

Bug summary
With NumPy v1.16.0, the use of np.asscalar() is deprecated and will probably be removed later on.
Currently, in Matplotlib v2.2.3, there are still three instances of this function being used.
Given that Matplotlib v3.0.0+ no longer supports Python 2.7, I assume that the use of this function should be removed at some point (for v2.2.4?).

Code for reproduction
Installing Matplotlib v2.2.3 (in any Python version), going to the installation directory and executing (I do not know if this also works on anything besides Linux) grep -H -n np.asscalar *.py will return

colors.py:101:        ret = np.asscalar(ex)
image.py:425:                a_min = np.asscalar(a_min.astype(scaled_dtype))
image.py:426:                a_max = np.asscalar(a_max.astype(scaled_dtype))

If allowed, I can easily go and replace those instances with a.item() or equivalent (if necessary) and make a PR.

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