Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Bug]: Wrong scaling ofNonUniformImage with logarithmic axes #29368

Closed
Labels
@david-zwicker

Description

@david-zwicker

Bug summary

I'm trying to produce a density plot of logarithmically spaced data. UsingNonUniformImage used to work before matplotlib version3.10, where I know exhibit a weirdly scaled axis.

Code for reproduction

importnumpyasnpimportmatplotlib.pyplotaspltfrommatplotlib.imageimportNonUniformImagex=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 imageim=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 behaviorax1.set_title("NonUniformImage")# use pcolormesh to get reference imageax2.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

b32e9b79-dd12-44f9-b472-6ef09f886ac3

Expected outcome

I expect the left panel to look like the right panel, which was produced usingpcolormesh. The reason I don't want to usepcolormesh 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 askeda 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp