Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
Open
Labels
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_sizeh,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)uint8orfloat32>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