Bug summary
Use imshow to generate a figure, and then save it as a pdf file. If you open the generated pdf figure in Adobe Illustrator, the figure in Adobe Illustrator becomes different. Colors are wrongly assigned.
Code for reproduction
import numpy as np
import matplotlib.pyplot as plt
import matplotlib
print(matplotlib.__version__)
a = np.array([[1, 2, 3], [4, 5, 6]])
plt.matshow(a)
plt.savefig(‘test.pdf’)
Actual outcome

Expected outcome

Additional information
No response
Operating system
No response
Matplotlib Version
3.8.3
Matplotlib Backend
module://matplotlib_inline.backend_inline
Python version
3.10.13
Jupyter version
7.0.8
Installation
conda