Title: Plotting with fill_between and timedelta on yaxis throws TypeError · Issue #8352 · matplotlib/matplotlib · GitHub
Open Graph Title: Plotting with fill_between and timedelta on yaxis throws TypeError · Issue #8352 · matplotlib/matplotlib
X Title: Plotting with fill_between and timedelta on yaxis throws TypeError · Issue #8352 · matplotlib/matplotlib
Description: Bug report Hi everyone, I don't know whether it is a bug or a missing feature in numpy or matplotlib, but plotting with fill_between and a simple datetime.timedelta (x axis) throws the following exception: TypeError: ufunc 'isfinite' not...
Open Graph Description: Bug report Hi everyone, I don't know whether it is a bug or a missing feature in numpy or matplotlib, but plotting with fill_between and a simple datetime.timedelta (x axis) throws the following ex...
X Description: Bug report Hi everyone, I don't know whether it is a bug or a missing feature in numpy or matplotlib, but plotting with fill_between and a simple datetime.timedelta (x axis) throws the followin...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/8352
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Plotting with fill_between and timedelta on yaxis throws TypeError","articleBody":"### Bug report\r\nHi everyone,\r\nI don't know whether it is a bug or a missing feature in numpy or matplotlib, but plotting with` fill_between` and a simple `datetime.timedelta` (x axis) throws the following exception:\r\n\r\n`TypeError: ufunc 'isfinite' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''`\r\n\r\nHere is a simple (runnable) example:\r\n\r\n```python\r\nfrom datetime import timedelta\r\nfrom matplotlib import pyplot\r\nfrom pandas import DataFrame\r\n\r\nif __name__ == '__main__':\r\n df = DataFrame([[timedelta(seconds=0), 4], [timedelta(seconds=10), 5]], columns=['TIME', 'VALUE'])\r\n df = df.set_index('TIME')\r\n pyplot.fill_between(df.index, 0, df.VALUE)\r\n```\r\nFull stacktrace:\r\n```\r\nTraceback (most recent call last):\r\n File \"/de/test.py\", line 11, in \u003cmodule\u003e\r\n pyplot.fill_between(df.TIME, 0, df.VALUE)\r\n File \"/usr/lib/python3.6/site-packages/matplotlib/pyplot.py\", line 2896, in fill_between\r\n **kwargs)\r\n File \"/usr/lib/python3.6/site-packages/matplotlib/__init__.py\", line 1819, in inner\r\n return func(ax, *args, **kwargs)\r\n File \"/usr/lib/python3.6/site-packages/matplotlib/axes/_axes.py\", line 4581, in fill_between\r\n x = ma.masked_invalid(self.convert_xunits(x))\r\n File \"/usr/lib/python3.6/site-packages/numpy/ma/core.py\", line 2340, in masked_invalid\r\n condition = ~(np.isfinite(a))\r\nTypeError: ufunc 'isfinite' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''\r\n```\r\nWith dates, everthing works as expected:\r\n\r\n```python\r\nfrom matplotlib import pyplot\r\nfrom pandas import DataFrame\r\nimport pandas\r\n\r\n\r\nif __name__ == '__main__':\r\n df = DataFrame([[1488364614802, 4], [1488364615802, 5]], columns=['TIME', 'VALUE'])\r\n df.TIME = pandas.to_datetime(df.TIME, unit='ms')\r\n df = df.set_index('TIME')\r\n print(df)\r\n pyplot.fill_between(df.index, 0, df.VALUE)\r\n```\r\n\r\n**Matplotlib version**\r\nMatplotlub version: Version: 2.0.0 (via pip)\r\nPython 3.6.0\r\nPlattform: Linux 4.10.1-1 x86_64\r\n\r\n\r\n","author":{"url":"https://github.com/SebastianRzk","@type":"Person","name":"SebastianRzk"},"datePublished":"2017-03-20T19:54:45.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":10},"url":"https://github.com/8352/matplotlib/issues/8352"}
| 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:90a21911-5a55-e808-2425-5a3b7393114a |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 839A:1B8892:AA1A:DB80:6A52E507 |
| html-safe-nonce | 49dfdec63b7afec17504085a4f3c02490f74bb9409f492e8a71b2c966509697b |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4MzlBOjFCODg5MjpBQTFBOkRCODA6NkE1MkU1MDciLCJ2aXNpdG9yX2lkIjoiNDE0NjgzMzI2NTg1OTQyMTQ0NyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 6460c06fc814556e0e3d6142860c3cbf58edae84e563d9a6b910a0b050106a2b |
| hovercard-subject-tag | issue:215536517 |
| 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/8352/issue_layout |
| twitter:image | https://opengraph.githubassets.com/4e0b8561795ced68515065625ba17e1b0c1aac62f5cab9408c3197531ac77c9a/matplotlib/matplotlib/issues/8352 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/4e0b8561795ced68515065625ba17e1b0c1aac62f5cab9408c3197531ac77c9a/matplotlib/matplotlib/issues/8352 |
| og:image:alt | Bug report Hi everyone, I don't know whether it is a bug or a missing feature in numpy or matplotlib, but plotting with fill_between and a simple datetime.timedelta (x axis) throws the following ex... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | SebastianRzk |
| 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