Title: Cleanup API for setting ticks · Issue #15005 · matplotlib/matplotlib · GitHub
Open Graph Title: Cleanup API for setting ticks · Issue #15005 · matplotlib/matplotlib
X Title: Cleanup API for setting ticks · Issue #15005 · matplotlib/matplotlib
Description: Inspired by #14980 (comment). Current APIs: pyplot.xticks(ticks=None, labels=None, **kwargs) Axes.set_xticks(self, ticks, minor=False) Axes.set_xticklabels(self, labels, fontdict=None, minor=False, **kwargs) Notes: The Axes methods are j...
Open Graph Description: Inspired by #14980 (comment). Current APIs: pyplot.xticks(ticks=None, labels=None, **kwargs) Axes.set_xticks(self, ticks, minor=False) Axes.set_xticklabels(self, labels, fontdict=None, minor=False,...
X Description: Inspired by #14980 (comment). Current APIs: pyplot.xticks(ticks=None, labels=None, **kwargs) Axes.set_xticks(self, ticks, minor=False) Axes.set_xticklabels(self, labels, fontdict=None, minor=False,...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/15005
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Cleanup API for setting ticks","articleBody":"Inspired by https://github.com/matplotlib/matplotlib/issues/14980#issuecomment-518156902.\r\n\r\nCurrent APIs:\r\n\r\n~~~\r\npyplot.xticks(ticks=None, labels=None, **kwargs)\r\n\r\nAxes.set_xticks(self, ticks, minor=False)\r\nAxes.set_xticklabels(self, labels, fontdict=None, minor=False, **kwargs)\r\n~~~\r\n\r\nNotes:\r\n- The `Axes` methods are just thin wrappers around the `Axis` methods.\r\n- The kwargs are `Text` properties.\r\n\r\n### Issue\r\nThe Axes API feels a bit odd. AFAICS `set_xticklabels` does not make much sense without `set_xticks` before; otherwise how do I know that the labels will be at the correct places and that I have the right number of labels for the ticks.\r\n\r\n### Proposal\r\n1. [x] Extend the API of `set_xticks` to be\r\n ~~~\r\n Axes.set_xticks(self, ticks, labels=None, minor=False, **kwargs)\r\n ~~~\r\n maybe even with `ticks=None` to be compatible with the pyplot API - though I don't know if one needs the ability to set ticks without positions.\r\n2. [x] Soft-deprecate `set_xticklabels`. It's too widely used to be deprecated, but we shouldn't have two equal ways here.\r\n3. [ ] Optionally add the minor kwarg to `pyplot.xticks`; it's not strictly necessary because pyplot may have less functionality than the OOP interface; but it doesn't hurt either.\r\n\r\nThe proposed signature would be an API-change because the minor argument might have been passed positionally. Thus, we should start with `_make_keyword_only` on that parameter.","author":{"url":"https://github.com/timhoffm","@type":"Person","name":"timhoffm"},"datePublished":"2019-08-07T23:53:17.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":15},"url":"https://github.com/15005/matplotlib/issues/15005"}
| 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:d97d69f7-b0e5-ca7b-74d9-046a65991a81 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9CD2:399A66:332541:463421:6A537280 |
| html-safe-nonce | c3d91f38c256a24de32f61c9dc698ffbea77c0eba07a27bce7896091feeb4ac2 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5Q0QyOjM5OUE2NjozMzI1NDE6NDYzNDIxOjZBNTM3MjgwIiwidmlzaXRvcl9pZCI6IjEwMTkyNTM5NDIyMjY0ODE3OTIiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 4ee3cb7d24d497ac510c00cebc9949267fb8ee3ada46159decf5a8bb15efb359 |
| hovercard-subject-tag | issue:478187507 |
| 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/15005/issue_layout |
| twitter:image | https://opengraph.githubassets.com/35795aaf248d14ca3219fc959f0d6cc5b6ead6bbd09c5b91f52ee628e2edc958/matplotlib/matplotlib/issues/15005 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/35795aaf248d14ca3219fc959f0d6cc5b6ead6bbd09c5b91f52ee628e2edc958/matplotlib/matplotlib/issues/15005 |
| og:image:alt | Inspired by #14980 (comment). Current APIs: pyplot.xticks(ticks=None, labels=None, **kwargs) Axes.set_xticks(self, ticks, minor=False) Axes.set_xticklabels(self, labels, fontdict=None, minor=False,... |
| 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 | canary-2 |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width