Skip to content

Added elif for taking NumPy Array for imsave #29641

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
4 changes: 3 additions & 1 deletion lib/matplotlib/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -1586,9 +1586,11 @@
# because that's what backend_agg passes, and can be in fact used
# as is, saving a few operations.
rgba = arr
elif arr.ndim == 3 and arr.shape[-1] in (3,4):

Check failure on line 1589 in lib/matplotlib/image.py

View workflow job for this annotation

GitHub Actions / flake8

[flake8] reported by reviewdog 🐶 E231 missing whitespace after ',' Raw Output: ./lib/matplotlib/image.py:1589:51: E231 missing whitespace after ','
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this work for shape[-1] == 3? AFAICS, rgba should have the alpha component included eventually?

rgba = arr

Check failure on line 1590 in lib/matplotlib/image.py

View workflow job for this annotation

GitHub Actions / flake8

[flake8] reported by reviewdog 🐶 E117 over-indented Raw Output: ./lib/matplotlib/image.py:1590:17: E117 over-indented
else:
sm = mcolorizer.Colorizer(cmap=cmap)
sm.set_clim(vmin, vmax)
sm.set_clim(vim, vmax)

Check failure on line 1593 in lib/matplotlib/image.py

View workflow job for this annotation

GitHub Actions / flake8

[flake8] reported by reviewdog 🐶 F405 'vim' may be undefined, or defined from star imports: matplotlib._image Raw Output: ./lib/matplotlib/image.py:1593:25: F405 'vim' may be undefined, or defined from star imports: matplotlib._image
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like an unintended edit

rgba = sm.to_rgba(arr, bytes=True)
if pil_kwargs is None:
pil_kwargs = {}
Expand Down
Loading