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]: Irregular pixel widths in rasterized pcolor #23391

Closed as not planned
Closed as not planned
@mschroen

Description

@mschroen

Bug summary

Pixel widths appear irregularly inpcolor(x, y, z, rasterized=True), whilex andy are regular. Usingrasterized=False provides correct (equal size) pixels, but saving the figure to.png (instead of.pdf) will show the same irregular pixel width bug.

It looks like a resampling bug, which messes up precise data visualization completely.

Code for reproduction

importnumpyasnpimportmatplotlib.pyplotaspltx,y=np.meshgrid(range(500),range(2))z= [np.tile([0,1],250),np.tile([0,1],250)]fig,ax=plt.subplots(1,1,figsize=(10,2))im=ax.pcolor(x,y,z,rasterized=True)ax.set_xticks(np.arange(0,40))fig.savefig('test.pdf')plt.show()

Actual outcome

In the resulting plot, some pixels are thinner, and some are thicker, than they should be.
rasterize=True (zoom-in to the lower left corner)
grafik

Expected outcome

rasterize=False (zoom-in to the lower left corner)
grafik

Additional information

  • This behaviour depends on the number of pixels plotted, for me it becomes visible abovelen(x)>100.
  • The spread between thicker and thinner lines increases with increasing size of the input array.
  • If the view is reduced to a lower number of pixels (e.g.,ax.set_xlim(0,10)), the effect is no longer visible.

Operating system

Windows

Matplotlib Version

3.5.1

Matplotlib Backend

inline

Python version

3.9.6

Jupyter version

No response

Installation

pip

Metadata

Metadata

Assignees

No one assigned

    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