Title: calling annotate with nan values for the position still gives error after 3.0.2 · Issue #13276 · matplotlib/matplotlib · GitHub
Open Graph Title: calling annotate with nan values for the position still gives error after 3.0.2 · Issue #13276 · matplotlib/matplotlib
X Title: calling annotate with nan values for the position still gives error after 3.0.2 · Issue #13276 · matplotlib/matplotlib
Description: Bug report Bug summary There was a previous issue #12648 which noted a regression in Matplotlib which meant calling annotate with a nan position caused an error when using the command plt.tight_layout(). This issue was then closed by #12...
Open Graph Description: Bug report Bug summary There was a previous issue #12648 which noted a regression in Matplotlib which meant calling annotate with a nan position caused an error when using the command plt.tight_lay...
X Description: Bug report Bug summary There was a previous issue #12648 which noted a regression in Matplotlib which meant calling annotate with a nan position caused an error when using the command plt.tight_lay...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/13276
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"calling annotate with nan values for the position still gives error after 3.0.2","articleBody":"### Bug report\r\n\r\n**Bug summary**\r\n\r\nThere was a previous issue #12648 which noted a regression in Matplotlib which meant calling annotate with a nan position caused an error when using the command `plt.tight_layout()`. This issue was then closed by #12651, however with Matplotlib 3.0.2 I still am recieving an error with the following code, which I think should be functionally the same:\r\n\r\n```python\r\nimport matplotlib.pyplot as plt\r\n\r\nfig, ax = plt.subplots()\r\n\r\nax.annotate(\"\", xy=(0, float('nan')))\r\n\r\n# If axis is set on then a ValueError is thrown when calculating ticks\r\n# If axis is set off then a RuntimeError: libpng signaled error is thrown\r\nax.set_axis_off()\r\nfig.savefig(\"bar.png\", bbox_inches='tight')\r\n```\r\n\r\n**Actual outcome**\r\n\r\n```\r\nlibpng warning: Image width is zero in IHDR\r\nlibpng warning: Image height is zero in IHDR\r\nlibpng error: Invalid IHDR data\r\nTraceback (most recent call last):\r\n File \"\u003cstdin\u003e\", line 1, in \u003cmodule\u003e\r\n File \"/Users/michael/conda/envs/nnpdf/lib/python3.7/site-packages/matplotlib/figure.py\", line 2094, in savefig\r\n self.canvas.print_figure(fname, **kwargs)\r\n File \"/Users/michael/conda/envs/nnpdf/lib/python3.7/site-packages/matplotlib/backend_bases.py\", line 2075, in print_figure\r\n **kwargs)\r\n File \"/Users/michael/conda/envs/nnpdf/lib/python3.7/site-packages/matplotlib/backends/backend_agg.py\", line 523, in print_png\r\n self.figure.dpi, metadata=metadata)\r\nRuntimeError: libpng signaled error\r\n```\r\n\r\n**Expected outcome**\r\n\r\nI think this minimal example should just return an empty figure and ignore the annotation with NaN position. Maybe I'm mistaken but I would have thought it should be the same output as\r\n```\r\nplt.tight_layout()\r\nplt.savefig(\"bar.png\")\r\n```\r\nwhich does work as per the #12651\r\n\r\n**Matplotlib version**\r\n * Operating system: OSX, but also tested on linux\r\n * Matplotlib version: 3.0.2\r\n * Matplotlib backend (`print(matplotlib.get_backend())`): TkAgg\r\n * Python version: 3.7.2\r\n\r\n(conda installation)\r\n\r\n\r\n","author":{"url":"https://github.com/wilsonmr","@type":"Person","name":"wilsonmr"},"datePublished":"2019-01-24T12:18:17.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":2},"url":"https://github.com/13276/matplotlib/issues/13276"}
| 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:c905948e-662d-1e62-9f28-a39413f8fb2b |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9C20:11304E:1CD49F0:2794CD0:6A540172 |
| html-safe-nonce | 3277f748097f0ea39d3626fef83586a65445ee477b1f6c836ac08141374b7bc8 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5QzIwOjExMzA0RToxQ0Q0OUYwOjI3OTRDRDA6NkE1NDAxNzIiLCJ2aXNpdG9yX2lkIjoiNjYyNzU2MTE3NDY2ODQxNDU4IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | fdd2932f05b13d0f55dbc820dfcc1e084d6bdd381558230b53e512ee6ddef951 |
| hovercard-subject-tag | issue:402681214 |
| 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/13276/issue_layout |
| twitter:image | https://opengraph.githubassets.com/ba922a4424110e15570c3faa7a6fdaa0a513d22eec40fdaefed9b65a3ea9dc04/matplotlib/matplotlib/issues/13276 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/ba922a4424110e15570c3faa7a6fdaa0a513d22eec40fdaefed9b65a3ea9dc04/matplotlib/matplotlib/issues/13276 |
| og:image:alt | Bug report Bug summary There was a previous issue #12648 which noted a regression in Matplotlib which meant calling annotate with a nan position caused an error when using the command plt.tight_lay... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | wilsonmr |
| hostname | github.com |
| expected-hostname | github.com |
| None | b9a586c06a05a7a86fc7e3f4dbd03e42f6869085879aa184aa6369456dbd50fb |
| 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 | 07a982c1d40157c619b364352b704c3ce66bb332 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width