Bug summary
I'm trying to produce a density plot of logarithmically spaced data. Using NonUniformImage used to work before matplotlib version 3.10, where I know exhibit a weirdly scaled axis.
Code for reproduction
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.image import NonUniformImage
x = np.linspace(0, 1, 2)
y = np.geomspace(1e1, 1e5, 3)
z = np.random.uniform(size=(len(x), len(y)))
_, (ax1, ax2) = plt.subplots(ncols=2)
# create the non-uniform image
im = NonUniformImage(ax1, extent=[0, 1, 1e0, 1e6], origin="lower")
im.set_data(x, y, z.T)
ax1.add_image(im)
ax1.set_yscale("log")
ax1.set_ylim(1e0, 1e6) # omitting this leads to very weird behavior
ax1.set_title("NonUniformImage")
# use pcolormesh to get reference image
ax2.pcolormesh([0, 0.5, 1], [1e0, 1e2, 1e4, 1e6], z.T)
ax2.set_yscale("log")
ax2.set_title("pcolormesh")
Actual outcome
The code above produces the following image

Expected outcome
I expect the left panel to look like the right panel, which was produced using pcolormesh. The reason I don't want to use pcolormesh for these plots is that the quality in PDFs is often much worse (with lines showing up between patches) and the file size can easily be 10 times larger.
Additional information
I recently asked a related question on Stackoverflow, which has some additional details.
Operating system
OS/X
Matplotlib Version
3.10.0
Matplotlib Backend
module://matplotlib_inline.backend_inline
Python version
3.12.8
Jupyter version
7.3.1
Installation
conda
Bug summary
I'm trying to produce a density plot of logarithmically spaced data. Using
NonUniformImageused to work before matplotlib version3.10, where I know exhibit a weirdly scaled axis.Code for reproduction
Actual outcome
The code above produces the following image
Expected outcome
I expect the left panel to look like the right panel, which was produced using
pcolormesh. The reason I don't want to usepcolormeshfor these plots is that the quality in PDFs is often much worse (with lines showing up between patches) and the file size can easily be 10 times larger.Additional information
I recently asked a related question on Stackoverflow, which has some additional details.
Operating system
OS/X
Matplotlib Version
3.10.0
Matplotlib Backend
module://matplotlib_inline.backend_inline
Python version
3.12.8
Jupyter version
7.3.1
Installation
conda