Title: [Bug]: `Axes.pcolorfast()` not working with `datetime` · Issue #27559 · matplotlib/matplotlib · GitHub
Open Graph Title: [Bug]: `Axes.pcolorfast()` not working with `datetime` · Issue #27559 · matplotlib/matplotlib
X Title: [Bug]: `Axes.pcolorfast()` not working with `datetime` · Issue #27559 · matplotlib/matplotlib
Description: Bug summary As of Dec. 11 2023, Axes.pcolorfast() seems to not work with datetime; see #27450 for more details. Code for reproduction import numpy as np import matplotlib.pyplot as plt import matplotlib.dates as dt import matplotlib as m...
Open Graph Description: Bug summary As of Dec. 11 2023, Axes.pcolorfast() seems to not work with datetime; see #27450 for more details. Code for reproduction import numpy as np import matplotlib.pyplot as plt import matpl...
X Description: Bug summary As of Dec. 11 2023, Axes.pcolorfast() seems to not work with datetime; see #27450 for more details. Code for reproduction import numpy as np import matplotlib.pyplot as plt import matpl...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/27559
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[Bug]: `Axes.pcolorfast()` not working with `datetime`","articleBody":"### Bug summary\n\nAs of Dec. 11 2023, `Axes.pcolorfast()` seems to not work with `datetime`; see #27450 for more details.\n\n### Code for reproduction\n\n```python\nimport numpy as np\r\nimport matplotlib.pyplot as plt\r\nimport matplotlib.dates as dt\r\nimport matplotlib as mpl\r\nimport datetime\r\n\r\nnp.random.seed(19680801)\r\n\r\n\r\n'''\r\nDirectly inputting datetime.datetime without processing them seems to generate compile errors for pcolorfast().\r\nI have used date2num() to ensure that the graph prints correctly despite that such operations may defy the purpose of conducting such tests.\r\n'''\r\nbasedate_x = datetime.datetime(2023, 12, 6, 1, 30, 30)\r\nbasedate_y = datetime.datetime(2024, 5, 5, 12, 15, 45)\r\ndates_x = [(basedate_x + datetime.timedelta(days=1*i, hours=6*i, minutes=20*i,seconds=0)) for i in range(10)]\r\ndates_y = [(basedate_y + datetime.timedelta(days=1*i, hours=8*i, minutes=30*i,seconds=0)) for i in range(10)]\r\ndata = np.random.rand(0, 100)\r\n\r\n\r\nfig, ax = plt.subplots()\r\n\r\npc = ax.pcolorfast(dates_x, dates_y, data)\r\n\r\nax.set_xlabel('Sample datetime')\r\nax.set_ylabel('Sample data')\r\nax.set_title('Sample test case for pcolorfast()')\r\n\r\nplt.show()\n```\n\n\n### Actual outcome\n\nTraceback (most recent call last):\r\n File \"personal directory omitted\", line 23, in \u003cmodule\u003e\r\n pc = ax.pcolorfast(dates_x, dates_y, data)\r\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r\n File \"C:\\Users\\andyx\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python311\\site-packages\\matplotlib\\__init__.py\", line 1478, in inner\r\n return func(ax, *map(sanitize_sequence, args), **kwargs)\r\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r\n File \"C:\\Users\\andyx\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python311\\site-packages\\matplotlib\\axes\\_axes.py\", line 6501, in pcolorfast\r\n self.update_datalim(np.array([[xl, yb], [xr, yt]]))\r\n File \"C:\\Users\\andyx\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python311\\site-packages\\matplotlib\\axes\\_base.py\", line 2510, in update_datalim\r\n if not np.any(np.isfinite(xys)):\r\n ^^^^^^^^^^^^^^^^\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''\n\n### Expected outcome\n\nIt has been assumed that a graph should be produced similar to the one below, but with actual `datetime` as axes:\r\n\n\n### Additional information\n\nThis is part of a test case for issue #26864 ; same issue has been met when the same code is ran on matplotlib ver 3.7.1 on Google Colab.\n\n### Operating system\n\nWindows 10\n\n### Matplotlib Version\n\n3.8.2\n\n### Matplotlib Backend\n\n_No response_\n\n### Python version\n\n3.11.7\n\n### Jupyter version\n\n_No response_\n\n### Installation\n\npip","author":{"url":"https://github.com/AndyXi163","@type":"Person","name":"AndyXi163"},"datePublished":"2023-12-22T20:28:50.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/27559/matplotlib/issues/27559"}
| 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:0209e821-e884-d831-ae6d-d52c0424ee1c |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8CEC:13DB1B:110ED09:16E4ECA:6A51C587 |
| html-safe-nonce | 53be0741a06b6c50b112a1e2eb042dae888eb9caa39a8e977af002c563e88015 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4Q0VDOjEzREIxQjoxMTBFRDA5OjE2RTRFQ0E6NkE1MUM1ODciLCJ2aXNpdG9yX2lkIjoiMjUwMTIyMzEzOTE3MTc0NzIwNyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | b95959ab2926890a2f94b5184765ac5c26553d25b7e56a735e6c1255732b8740 |
| hovercard-subject-tag | issue:2054484721 |
| 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/27559/issue_layout |
| twitter:image | https://opengraph.githubassets.com/da5b92f7f38caeb8bcd1409f5d77a86484352c5e7e5c0991e8df2926d06c893a/matplotlib/matplotlib/issues/27559 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/da5b92f7f38caeb8bcd1409f5d77a86484352c5e7e5c0991e8df2926d06c893a/matplotlib/matplotlib/issues/27559 |
| og:image:alt | Bug summary As of Dec. 11 2023, Axes.pcolorfast() seems to not work with datetime; see #27450 for more details. Code for reproduction import numpy as np import matplotlib.pyplot as plt import matpl... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | AndyXi163 |
| 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 | 7aed05249554b889eb33d002851a973eebcc7e91 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width