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

Some short lines added withplot() are missing in the PNG output depending on DPI #20192

Open
@tskir

Description

@tskir

Bug report

Depending on DPI, a figure saved as PNG is missing some short lines.

Code for reproduction

importmatplotlibfrommatplotlibimportpyplotaspltimportnumpyasnpmatplotlib.use('agg')# Generate a set of 50 random points.np.random.seed(0)all_x,all_y= (np.random.rand(50)for_inrange(2))# Scatter dots in blue.plt.scatter(all_x,all_y,c='blue',s=2)# Plot very short lines (length 0.001) in red with a small offset on Y.forx,yinzip(all_x,all_y):plt.plot((x,x+0.001), (y+0.01,y+0.01),c='red',linewidth=2)# Save with different resolutionsplt.savefig('bug_96.png',dpi=96)plt.savefig('bug_300.png',dpi=300)

Actual outcome

Depending on export DPI, some short segments (in red, added byplot()) are missing, while all dots (in blue, added byscatter() are always present).

At 96 DPI:
image

At 300 DPI:
image

Expected outcome

The segments should be always present, regardless of the resolution.

Matplotlib version

  • Operating system: Ubuntu 20.04.2 LTS
  • Matplotlib version (import matplotlib; print(matplotlib.__version__)): 3.4.2
  • Matplotlib backend (print(matplotlib.get_backend())):agg
  • Python version: 3.8.5

Python is installed via apt-get, Matplotlib installed system-wide using 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