Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
Closed
Labels
Milestone
Description
Bug summary
When I give an RGB image as a list of list of list to imsave, I don't have the right colormap and there is no rgb colormap!
Code for reproduction
importmatplotlib.pyplotaspltI=plt.imread("notre-dame.jpg")m,n,p=I.shape#m=largeur, n=hauteur, p=upletJ=[[[0fordinrange(p)]foreinrange(n)]forfinrange(m)]K=[[[0fordinrange(p)]foreinrange(n)]forfinrange(m)]L=[[[0fordinrange(p)]foreinrange(n)]forfinrange(m)]foriinrange(m) :forjinrange(n) :J[i][j]=[int(I[i][j][0]),0,0]K[i][j]=[0,int(I[i][j][1]),0]L[i][j]=[0,0,int(I[i][j][2])]fig,ax=plt.subplots(4,figsize=(28,10))ax[0].imshow(I)ax[1].imshow(J)ax[2].imshow(K)ax[3].imshow(L)ax[0].set_axis_off()ax[1].set_axis_off()ax[2].set_axis_off()ax[3].set_axis_off()ax[0].set_title('Image complete')ax[1].set_title('Composante rouge')ax[2].set_title('Composante bleue')ax[3].set_title('Composante verte')fig.suptitle("Image de Notre-Dame",x=0.51,y=.93)plt.imsave("Notre-Dame_rouge.png",J)#The problem is here!plt.savefig("Notre-Dame_composante_ex1.png",dpi=750,bbox_inches="tight")plt.savefig("Notre-Dame_composante_ex1.pdf",dpi=750,bbox_inches="tight")plt.show()
Actual outcome
Expected outcome
Additional information
Operating system
Win 11
Matplotlib Version
3.9.2
Matplotlib Backend
module://matplotlib_inline.backend_inline
Python version
3.11.10
Jupyter version
No response
Installation
conda