Title: [ENH]: More accurate type stub for `plt.subplots` like VSCode did before. · Issue #28226 · matplotlib/matplotlib · GitHub
Open Graph Title: [ENH]: More accurate type stub for `plt.subplots` like VSCode did before. · Issue #28226 · matplotlib/matplotlib
X Title: [ENH]: More accurate type stub for `plt.subplots` like VSCode did before. · Issue #28226 · matplotlib/matplotlib
Description: Problem Before matplotlib 3.8, VSCode embedded its type stubs for matplotlib. At that time, the typehint of plt.subplots is better than the typehint provided by matplotlib itself. You can see the differences below: Let's see the embedded...
Open Graph Description: Problem Before matplotlib 3.8, VSCode embedded its type stubs for matplotlib. At that time, the typehint of plt.subplots is better than the typehint provided by matplotlib itself. You can see the d...
X Description: Problem Before matplotlib 3.8, VSCode embedded its type stubs for matplotlib. At that time, the typehint of plt.subplots is better than the typehint provided by matplotlib itself. You can see the d...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/28226
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[ENH]: More accurate type stub for `plt.subplots` like VSCode did before.","articleBody":"### Problem\r\n\r\nBefore matplotlib 3.8, VSCode embedded its type stubs for matplotlib. At that time, the typehint of `plt.subplots` is better than the typehint provided by matplotlib itself. You can see the differences below:\r\n\r\nLet's see the embedded typehint for plt.subplots. I made it available by changing the Matplotlib version to 3.7. It can identify the `ax` type correctly.\r\n\r\nHowever, after upgrading to matplotlib 3.8. [The VSCode use the type stub provided by matplotlib instead of the one embedded by itself](https://github.com/microsoft/pylance-release/issues/4351#issuecomment-1737986648). And it cannot get the corrent type for `ax`.\r\n\r\n\r\n\r\n\r\n\r\n\r\n### Proposed solution\r\n\r\nAdapt the type stub provided by VSCode. You can see them in https://github.com/microsoft/python-type-stubs/blob/102c1448f7504d6450a221ae9c29a260fa741a30/matplotlib/pyplot.pyi#L200C1-L209C30.\r\n\r\nI tried just putting the `pyplot.pyi` file in the `pyplot.py` folder. It works. So maybe we can do it in repo.","author":{"url":"https://github.com/cesaryuan","@type":"Person","name":"cesaryuan"},"datePublished":"2024-05-15T03:28:27.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/28226/matplotlib/issues/28226"}
| 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:7009cc40-f6d9-086a-2815-19b5eaa2e390 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9CB2:2E411E:183E75B:20CA753:6A535DCE |
| html-safe-nonce | 2e16dec7f597424bec9a421a6b6e57f28a8d3930b3a753c3ffc6b94b1dd36d9d |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5Q0IyOjJFNDExRToxODNFNzVCOjIwQ0E3NTM6NkE1MzVEQ0UiLCJ2aXNpdG9yX2lkIjoiNTI2ODEzNTY5MjU1NDMxNjMwIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 65dc92c1c278c19f15ac6e0d22739273ec959cb63e110e2701a6f18ee2efa1d2 |
| hovercard-subject-tag | issue:2296785749 |
| 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/28226/issue_layout |
| twitter:image | https://opengraph.githubassets.com/6fc0862869fddaa549147486d8cb1407614f3f131130d78e6252a713a2ddf515/matplotlib/matplotlib/issues/28226 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/6fc0862869fddaa549147486d8cb1407614f3f131130d78e6252a713a2ddf515/matplotlib/matplotlib/issues/28226 |
| og:image:alt | Problem Before matplotlib 3.8, VSCode embedded its type stubs for matplotlib. At that time, the typehint of plt.subplots is better than the typehint provided by matplotlib itself. You can see the d... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | cesaryuan |
| 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