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 as not planned
Milestone
Description
Bug summary
Plotting an equal numpy.array of dtype float64 and float32 with pyplot.imshow and a defined colors.LogNorm as norm will produce different colors in the resulting image.
Code for reproduction
importmatplotlib.pyplotaspltimportmatplotlib.colorsascolorsimportnumpyasnpnorm=colors.LogNorm(vmin=1e-10,vmax=1)test_numpy=np.array([[1e-4]])test_numpy_32=np.array([[1e-4]],dtype=np.float32)fortestin [test_numpy,test_numpy_32]:plt.imshow(test,norm=norm)plt.title(f"numpy array of dtype:{test.dtype}")plt.colorbar()plt.show()
Actual outcome
The resulting plot for the dtype float64 numpy.array looks like this:
and the plot for the dtype float32 numpy.array looks like this:
Expected outcome
I would expect both outputs to have the same color.
Additional information
No response
Operating system
Arch
Matplotlib Version
3.9.1.post1
Matplotlib Backend
module://matplotlib_inline.backend_inline
Python version
Python 3.12.4
Jupyter version
No response
Installation
pip
Metadata
Metadata
Assignees
Labels
No labels