Title: [Bug]: Units behavior of `tri*` methods · Issue #27499 · matplotlib/matplotlib · GitHub
Open Graph Title: [Bug]: Units behavior of `tri*` methods · Issue #27499 · matplotlib/matplotlib
X Title: [Bug]: Units behavior of `tri*` methods · Issue #27499 · matplotlib/matplotlib
Description: Bug summary As seen in #27491, #27488, #27494, #27487 It appears that the tri* methods do not actually properly handle units. Code for reproduction fig, ax = plt.subplots() np.random.seed(19680801) limit_value = 30 startdate = np.datetim...
Open Graph Description: Bug summary As seen in #27491, #27488, #27494, #27487 It appears that the tri* methods do not actually properly handle units. Code for reproduction fig, ax = plt.subplots() np.random.seed(19680801)...
X Description: Bug summary As seen in #27491, #27488, #27494, #27487 It appears that the tri* methods do not actually properly handle units. Code for reproduction fig, ax = plt.subplots() np.random.seed(19680801)...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/27499
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[Bug]: Units behavior of `tri*` methods","articleBody":"### Bug summary\n\nAs seen in #27491, #27488, #27494, #27487\r\n\r\nIt appears that the `tri*` methods _do not_ actually properly handle units.\n\n### Code for reproduction\n\n```python\nfig, ax = plt.subplots()\r\nnp.random.seed(19680801)\r\nlimit_value = 30\r\n\r\nstartdate = np.datetime64(\"2023-12-01\")\r\n\r\nx_dates = startdate + np.random.randint(0, 15, size=(limit_value-1,)).astype(\"timedelta64[D]\")\r\ny_dates = startdate + np.random.randint(0, 15,size=(limit_value-1,)).astype(\"timedelta64[D]\")\r\n\r\nx_dates_converted = mpl.dates.date2num(x_dates)\r\n\r\ny_data = np.random.rand(limit_value - 1)\r\n\r\nz_data = np.sin(x_dates_converted) + np.cos(y_data)\r\n\r\nax.triplot(x_dates, y_dates)\r\nax.tripcolor(x_dates, y_dates, z_data)\r\n#ax.tricontour(x_dates, y_dates, z_data)\r\n#ax.tricontourf(x_dates, y_dates, z_data)\n```\n\n\n### Actual outcome\n\nPrior to (probably, though I didn't actually bisect it) #24522, the code would actually error, as it attempted to cast the x/y arrays to float64 arrays.\r\n\r\nNow it will actually work to plot (seemingly even getting the actual values converted, though now that I think about it not sure _where_... my guess is that it is actually coincidental that they are `datetime64[D]` dtype which _happens_ to be the same scale/epoch as mpl, but it is not actually being properly converted) however it does _not_ set the Formatters/etc.\n\n### Expected outcome\n\nUnits are set properly (including axisinfo such as formatters).\n\n### Additional information\n\n_No response_\n\n### Operating system\n\n_No response_\n\n### Matplotlib Version\n\n3.9.0.dev821+gfa6be74127 (~main currently)\n\n### Matplotlib Backend\n\n_No response_\n\n### Python version\n\n_No response_\n\n### Jupyter version\n\n_No response_\n\n### Installation\n\ngit checkout","author":{"url":"https://github.com/ksunden","@type":"Person","name":"ksunden"},"datePublished":"2023-12-12T00:49:42.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/27499/matplotlib/issues/27499"}
| 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:6e9e3ab8-6be5-93d2-2afb-2f5d99bf2a40 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B68E:2A4A92:BDBA4B:C104A1:6A51274C |
| html-safe-nonce | 8886771cd91ea0a6ab014f7ab3bfd437395331dd270909d2aaf20a6d3a58f21f |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCNjhFOjJBNEE5MjpCREJBNEI6QzEwNEExOjZBNTEyNzRDIiwidmlzaXRvcl9pZCI6IjQyMzgzOTk3OTk2NTE1NDI4NjAiLCJyZWdpb25fZWRnZSI6InNlYSIsInJlZ2lvbl9yZW5kZXIiOiJzZWEifQ== |
| visitor-hmac | a432aa380f47c2b7a0e190ac025c5694d9c308a48aef55fd15f63ad9d16cdb43 |
| hovercard-subject-tag | issue:2036778576 |
| 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/27499/issue_layout |
| twitter:image | https://opengraph.githubassets.com/2a7e4d047805148f5d3adc44040570dcad25e7538b8467c2fd729ee0de563763/matplotlib/matplotlib/issues/27499 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/2a7e4d047805148f5d3adc44040570dcad25e7538b8467c2fd729ee0de563763/matplotlib/matplotlib/issues/27499 |
| og:image:alt | Bug summary As seen in #27491, #27488, #27494, #27487 It appears that the tri* methods do not actually properly handle units. Code for reproduction fig, ax = plt.subplots() np.random.seed(19680801)... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | ksunden |
| hostname | github.com |
| expected-hostname | github.com |
| None | 689b683944b0d7f015d0e776452c970832fa81b82dc15284469b556ecced715b |
| 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 | 942b51ed3bd5feee3d5e2719f890a5fe286edbbb |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width