Title: Incorrect imshow extent in PDF backend · Issue #8981 · matplotlib/matplotlib · GitHub
Open Graph Title: Incorrect imshow extent in PDF backend · Issue #8981 · matplotlib/matplotlib
X Title: Incorrect imshow extent in PDF backend · Issue #8981 · matplotlib/matplotlib
Description: Bug report Bug summary When plotting with imshow 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 ...
Open Graph Description: Bug report Bug summary When plotting with imshow 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...
X Description: Bug report Bug summary When plotting with imshow 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...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/8981
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Incorrect imshow extent in PDF backend","articleBody":"### Bug report\r\n\r\n**Bug summary**\r\n\r\nWhen plotting with `imshow` 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. \r\n\r\nThe 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. \r\n\r\nA minimal code example is given below (I've tested it with a blank matplotlibrc as well and the issue persists).\r\n\r\n**Code for reproduction**\r\n\r\n```python\r\nimport numpy as np\r\nimport matplotlib.pyplot as plt\r\n\r\nfig = plt.figure()\r\nfig.set_size_inches([2,2])\r\nax = fig.add_subplot(111)\r\n\r\nx0, x1 = 0.0, 1.0\r\n\r\nax.set_xlim(x0-0.1,x1+0.1)\r\nax.set_ylim(x0-0.1,x1+0.1)\r\n\r\nax.plot([x0,x0],[x0,x1],color='r',lw=0.1)\r\nax.plot([x1,x1],[x0,x1],color='r',lw=0.1)\r\nax.plot([x0,x1],[x0,x0],color='r',lw=0.1)\r\nax.plot([x0,x1],[x1,x1],color='r',lw=0.1)\r\n\r\nax.imshow(np.zeros((16,16))+0.5,\r\n cmap='Blues',\r\n origin='lower left',\r\n extent=(x0,x1,x0,x1),\r\n interpolation='none',\r\n vmin=0,vmax=1)\r\n\r\nfig.savefig(\"minimal.pdf\")\r\nfig.savefig(\"minimal.png\",dpi=600)\r\n```\r\n\r\n**Actual outcome**\r\n\r\nThe red outlines (set to match the extent) are *not* at the edge of the blue square. See the PDF examplee and the zoomed version (attached below).\r\n\r\n[minimal.pdf](https://github.com/matplotlib/matplotlib/files/1194753/minimal.pdf)\r\n\r\n\r\n**Expected outcome**\r\n\r\nThe 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).\r\n\r\n\r\n\r\n\r\n**Matplotlib version**\r\n * Operating System: Linux 4.12.3-1-ARCH\r\n * Matplotlib Version: 2.0.2 (Both packaged from Arch and latest version compiled myself)\r\n * Python Version: 2.7.13 and 3.6.2\r\n\r\n","author":{"url":"https://github.com/radioactivist","@type":"Person","name":"radioactivist"},"datePublished":"2017-08-02T17:46:05.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":12},"url":"https://github.com/8981/matplotlib/issues/8981"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:0000631a-0206-f006-0d93-6553f9b59993 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B7B2:A5565:9D2152:D9C53D:6A5133B9 |
| html-safe-nonce | 30100d8eeccab4677c23f2a5ba90cfaacb37613cf9df2cc5e5969d123e2db244 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCN0IyOkE1NTY1OjlEMjE1MjpEOUM1M0Q6NkE1MTMzQjkiLCJ2aXNpdG9yX2lkIjoiODQ2NDc0MDc4MTA1MTE2MzU3NyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 2304f1b6e87d52c3fb938adc5551f6b5f5573c8393a2ebc5cb90ceaecadb29e0 |
| hovercard-subject-tag | issue:247469267 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/matplotlib/matplotlib/8981/issue_layout |
| twitter:image | https://opengraph.githubassets.com/46e3eb50b8c9a8741ab7be3d72147eae9b7caedb192550631288e86c02b95372/matplotlib/matplotlib/issues/8981 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/46e3eb50b8c9a8741ab7be3d72147eae9b7caedb192550631288e86c02b95372/matplotlib/matplotlib/issues/8981 |
| og:image:alt | Bug report Bug summary When plotting with imshow 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... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | radioactivist |
| hostname | github.com |
| expected-hostname | github.com |
| None | e840f405b2718e8f2d55aafa9ff27dbce17e29d0c253011d05ea0fea3c78baff |
| turbo-cache-control | no-preview |
| go-import | github.com/matplotlib/matplotlib git https://github.com/matplotlib/matplotlib.git |
| octolytics-dimension-user_id | 215947 |
| octolytics-dimension-user_login | matplotlib |
| octolytics-dimension-repository_id | 1385122 |
| octolytics-dimension-repository_nwo | matplotlib/matplotlib |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1385122 |
| octolytics-dimension-repository_network_root_nwo | matplotlib/matplotlib |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 4ae6027e8ba70c79dc08249bb6cdc1a09d788496 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width