Title: Deprecate plot_date() · Issue #18154 · matplotlib/matplotlib · GitHub
Open Graph Title: Deprecate plot_date() · Issue #18154 · matplotlib/matplotlib
X Title: Deprecate plot_date() · Issue #18154 · matplotlib/matplotlib
Description: This is a writeup / proposal to serve as a basis for discussion in the dev call on 03 Aug 2020. plot_date() is essentially a thin wrapper around plot() but has different defaults for fmt. This causes confusion #17548, #18141. Context Use...
Open Graph Description: This is a writeup / proposal to serve as a basis for discussion in the dev call on 03 Aug 2020. plot_date() is essentially a thin wrapper around plot() but has different defaults for fmt. This caus...
X Description: This is a writeup / proposal to serve as a basis for discussion in the dev call on 03 Aug 2020. plot_date() is essentially a thin wrapper around plot() but has different defaults for fmt. This caus...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/18154
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Deprecate plot_date()","articleBody":"*This is a writeup / proposal to serve as a basis for discussion in the dev call on 03 Aug 2020.*\r\n\r\n`plot_date()` is essentially a thin wrapper around `plot()` but has different defaults for `fmt`. This causes confusion #17548, #18141.\r\n\r\n### Context\r\n\r\n- **Use case:** `plot_date()` dates back way before Matplotlib supported units. It's nowadays only necessary if you have plain numbers (in matplotlibs epoch). `datetime`s are directly handled in `plot()` via the unit system.\r\nWhile there may be users for `plot_date()`, i suppose it's rather a niche application.\r\n\r\n- **Naming:** The name is a bit misleading in that it suggests that you should use the function if you want to plot dates. This implicitly includes `datetime` / `date` which would be misleading. I'm suspecting that it may lead users with `datetime`/`date` objects on the wrong track. (`plot_as_date()` would have been more appropriate, but we're not gonna change that).\r\n\r\n- **API design:** `plot_date()` is an ad-hoc aggregation of `plot()` and `axis_date()`\r\n ~~~\r\n def plot_date(self, x, y, fmt='o', tz=None, xdate=True, ydate=False, **kwargs):\r\n if xdate:\r\n self.xaxis_date(tz)\r\n if ydate:\r\n self.yaxis_date(tz)\r\n return self.plot(x, y, fmt, **kwargs)\r\n ~~~ \r\n\r\n\r\n### Recommendation\r\nGiven the above context, I propose to deprecate `plot_date()` in favor of `ax.plot()` and `ax.x/yaxis.axis_date()`.\r\n\r\nAt the same time, deprecate `ax.x/yaxis_date()` in favor of `ax.x/yaxis.axis_date()`. This reduces the API footprint of `Axes`. IMHO we don't need to have wrappers `x/yfoo()` wrappers for every `foo()` function on the axis. While common ones like `set_x/ylabel()` have a justification, it's fine in general to use `ax.xaxis.foo()`.\r\n\r\n#### Alternatives:\r\n\r\n- Keep as is - I wouldn't do that as it's confusing users.\r\n- Change the default `fmt` to match `plot()` - Such a default change requires as much user action as the deprecation, but we keep all the unnecessary redundancy / imperfect naming.\r\n- Only soft-deprecate (i.e. add a note to discourage the use but keep the function). This would be an option if we're strongly concerned with not forcing users to change their `plot_date()` code.","author":{"url":"https://github.com/timhoffm","@type":"Person","name":"timhoffm"},"datePublished":"2020-08-02T16:06:18.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":6},"url":"https://github.com/18154/matplotlib/issues/18154"}
| 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:5379841d-661b-a3a9-a7b9-71fe92298387 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 815C:1D00CE:78EA2:A2243:6A527FA7 |
| html-safe-nonce | a9f1254a62129830b6a7e341604db4bab4044cabe202b6546af0d51f058c78d4 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4MTVDOjFEMDBDRTo3OEVBMjpBMjI0Mzo2QTUyN0ZBNyIsInZpc2l0b3JfaWQiOiI3NDIxMDg5NTMyMjg2NzYyOTE5IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 33c377f5f89d06ca24f055c9719bd1848bfce01c16276801f1388f5241e5f0e9 |
| hovercard-subject-tag | issue:671642865 |
| 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/18154/issue_layout |
| twitter:image | https://opengraph.githubassets.com/6e449163456c1ca0cbca0a5f8207f4056d332e0a3f6c18858526f359d9db36d1/matplotlib/matplotlib/issues/18154 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/6e449163456c1ca0cbca0a5f8207f4056d332e0a3f6c18858526f359d9db36d1/matplotlib/matplotlib/issues/18154 |
| og:image:alt | This is a writeup / proposal to serve as a basis for discussion in the dev call on 03 Aug 2020. plot_date() is essentially a thin wrapper around plot() but has different defaults for fmt. This caus... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | timhoffm |
| 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