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

Incorrect imshow extent in PDF backend #8981

Closed
@radioactivist

Description

@radioactivist

Bug report

Bug summary

When plotting withimshow using the PDF (or SVG) backend the right and top edges of the extent are not correct. The left and bottom edges seem to be correct.

The deviation is small but noticeable (I used a smaller figure size to make it more visible -- it seems not to scale with figure size). It also appears to be unaffected by the interpolation mode. I noticed while returning to an old set of scripts -- I think this wasn't an issue for MPL pre-2.0 but unfortunately I'm unable to be more specific than that.

A minimal code example is given below (I've tested it with a blank matplotlibrc as well and the issue persists).

Code for reproduction

importnumpyasnpimportmatplotlib.pyplotaspltfig=plt.figure()fig.set_size_inches([2,2])ax=fig.add_subplot(111)x0,x1=0.0,1.0ax.set_xlim(x0-0.1,x1+0.1)ax.set_ylim(x0-0.1,x1+0.1)ax.plot([x0,x0],[x0,x1],color='r',lw=0.1)ax.plot([x1,x1],[x0,x1],color='r',lw=0.1)ax.plot([x0,x1],[x0,x0],color='r',lw=0.1)ax.plot([x0,x1],[x1,x1],color='r',lw=0.1)ax.imshow(np.zeros((16,16))+0.5,cmap='Blues',origin='lower left',extent=(x0,x1,x0,x1),interpolation='none',vmin=0,vmax=1)fig.savefig("minimal.pdf")fig.savefig("minimal.png",dpi=600)

Actual outcome

The red outlines (set to match the extent) arenot at the edge of the blue square. See the PDF examplee and the zoomed version (attached below).

minimal.pdf
show-pdf-zoom

Expected outcome

The red outlines (set to match the extent) should be at the edge of the blue square. See the PNG example and the zoomed version (attached below).

minimal
show-png-zoom

Matplotlib version

  • Operating System: Linux 4.12.3-1-ARCH
  • Matplotlib Version: 2.0.2 (Both packaged from Arch and latest version compiled myself)
  • Python Version: 2.7.13 and 3.6.2

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions


    [8]ページ先頭

    ©2009-2025 Movatter.jp