Skip to content

MNT: Simplify code related to masked arrays #24758

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/matplotlib/ticker.py
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,7 @@ def set_powerlimits(self, lims):

def format_data_short(self, value):
# docstring inherited
if isinstance(value, np.ma.MaskedArray) and value.mask:
if value is np.ma.masked:
return ""
if isinstance(value, Integral):
fmt = "%d"
Expand Down
2 changes: 1 addition & 1 deletion lib/matplotlib/transforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -1854,7 +1854,7 @@ def transform_affine(self, points):
# The major speed trap here is just converting to the
# points to an array in the first place. If we can use
# more arrays upstream, that should help here.
if not isinstance(points, (np.ma.MaskedArray, np.ndarray)):
if not isinstance(points, np.ndarray):
_api.warn_external(
f'A non-numpy array of type {type(points)} was passed in '
f'for transformation, which results in poor performance.')
Expand Down