[ENH]: A data-type check is missed in cm.ScalarMappable.set_array() · Issue #21095 · matplotlib/matplotlib · GitHub
Skip to content

[ENH]: A data-type check is missed in cm.ScalarMappable.set_array() #21095

Description

@MiguelonGonzalez

Problem

If a list is introduced to cm.ScalarMappable.set_array() method, no error is raised and, nevertheless, probably an error will be raised.

At least, it's raised when using collections:

AttributeError: 'list' object has no attribute 'ndim'

Proposed solution

I think it could be great to add a data type check when data is introduced to this method Although the own name of the method means that the enter data-type must be a numpy array, I think it could be less messy if an exception (or something similar) would be added within this method.

Additional context and prior art

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    API: consistencyConsistency of the matplotlib API, including naming, behavior, defaults, …

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions