-
-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Closed as not planned
Closed as not planned
Copy link
Labels
status: closed as inactiveIssues closed by the "Stale" Github Action. Please comment on any you think should still be open.Issues closed by the "Stale" Github Action. Please comment on any you think should still be open.status: inactiveMarked by the “Stale” Github ActionMarked by the “Stale” Github Actiontopic: images
Description
Bug summary
I could not plot a 1-channel image while I was trying to populate a Subplots figure, although I can visualize it by using plt.imshow().
Code for reproduction
fig, axes = plt.subplots(3, 2, num=0)
# fig.canvas.mpl_connect('key_press_event', on_press)
h, w = image_size
h, w = int(h), int(w)
ax1 = axes[0][0].imshow(np.zeros((h, w, 3), dtype=np.float32))
ax2 = axes[0][1].imshow(np.zeros((h, w, 3), dtype=np.float32))
ax3 = axes[1][0].imshow(np.zeros((h, w, 3), dtype=np.float32))
ax4 = axes[1][1].imshow(np.zeros((h, w, 3), dtype=np.float32))
ax5 = axes[2][0].imshow(np.zeros((h, w), dtype=np.float32))
ax6 = axes[2][1].imshow(np.zeros((h, w), dtype=np.float32))
image_np = <(h,w) uint8 or float32>
image_pil = Image.fromarray(image_np).convert('RGB')
...
# ax5.set_data(image_np) # Fails!
# ax5.set_data(image_pil) # Works!
plt.imshow(image_np) # Works!
plt.draw()
plt.pause(1e-9)Actual outcome
Expected outcome
I used the Paint to generate the following image to demonstrate what I was expecting.
Additional information
No response
Operating system
Ubuntu 20.04
Matplotlib Version
3.5.1
Matplotlib Backend
TkAgg
Python version
Python 3.8.10
Jupyter version
No response
Installation
pip
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
status: closed as inactiveIssues closed by the "Stale" Github Action. Please comment on any you think should still be open.Issues closed by the "Stale" Github Action. Please comment on any you think should still be open.status: inactiveMarked by the “Stale” Github ActionMarked by the “Stale” Github Actiontopic: images

