Title: axes.format_{x,y} data should have a setter · Issue #17286 · matplotlib/matplotlib · GitHub
Open Graph Title: axes.format_{x,y} data should have a setter · Issue #17286 · matplotlib/matplotlib
X Title: axes.format_{x,y} data should have a setter · Issue #17286 · matplotlib/matplotlib
Description: In the Date tick labels example, the code for setting the cursor coords message overwrites the default formatters: ax.format_xdata = mdates.DateFormatter('%Y-%m-%d') ax.format_ydata = lambda x: '$%1.2f' % x # format the price. This creat...
Open Graph Description: In the Date tick labels example, the code for setting the cursor coords message overwrites the default formatters: ax.format_xdata = mdates.DateFormatter('%Y-%m-%d') ax.format_ydata = lambda x: '$%...
X Description: In the Date tick labels example, the code for setting the cursor coords message overwrites the default formatters: ax.format_xdata = mdates.DateFormatter('%Y-%m-%d') ax.format_ydata = lambd...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/17286
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"axes.format_{x,y} data should have a setter","articleBody":"In the [Date tick labels](https://matplotlib.org/3.1.1/gallery/text_labels_and_annotations/date.html#sphx-glr-gallery-text-labels-and-annotations-date-py) example, the code for setting the cursor coords message overwrites the default formatters:\r\n```python\r\nax.format_xdata = mdates.DateFormatter('%Y-%m-%d')\r\nax.format_ydata = lambda x: '$%1.2f' % x # format the price.\r\n```\r\nThis creates confusion because runs counter to how basically everything else in matplotlib is set via setter but especially the formatters:\r\n```python\r\nax.xaxis.set_major_formatter(mdates.DateFormatter('%Y'))\r\n```\r\nand [the docs](https://matplotlib.org/3.1.1/api/_as_gen/matplotlib.axes.Axes.format_xdata.html?highlight=format_xdata#matplotlib.axes.Axes.format_xdata) aren't especially clear either on this being a property:\r\n```\r\nAxes.format_xdata(self, x)\r\n\r\n Return x formatted as an x-value.\r\n\r\n This function will use the fmt_xdata attribute if it is not None, else will fall back on the xaxis major formatter.\r\n```\r\nTo be consistent with the API, I'm proposing properties/functions of the form:\r\n* `ax.{x,y}data_formatter(mdates.DateFormatter('%Y-%m-%d'))`\r\n* `ax.data_formatter(which=(x,y, both), mdates.DateFormatter('%Y-%m-%d'))`\r\n\r\n","author":{"url":"https://github.com/story645","@type":"Person","name":"story645"},"datePublished":"2020-04-30T22:28:16.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":4},"url":"https://github.com/17286/matplotlib/issues/17286"}
| 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:bcde465d-ba90-5c56-df70-500e2e5e0cf3 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A7A6:2DCF0:640AC:843D7:6A524A8C |
| html-safe-nonce | 1030cd3364a4b19584ec3dc5d7818573fcadca7c4751086326f8684732e200b8 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBN0E2OjJEQ0YwOjY0MEFDOjg0M0Q3OjZBNTI0QThDIiwidmlzaXRvcl9pZCI6Ijc1MjQxMjkwMjY0MDczMjgxMiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | d0f8166f57f7952984af86bff1935c44f44e844f0a01ad764a7a586b5b088289 |
| hovercard-subject-tag | issue:610429317 |
| 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/17286/issue_layout |
| twitter:image | https://opengraph.githubassets.com/01324f16a07b99b3a381eae012250aa8371a07c5ed529077ca7eb0a2b4db1647/matplotlib/matplotlib/issues/17286 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/01324f16a07b99b3a381eae012250aa8371a07c5ed529077ca7eb0a2b4db1647/matplotlib/matplotlib/issues/17286 |
| og:image:alt | In the Date tick labels example, the code for setting the cursor coords message overwrites the default formatters: ax.format_xdata = mdates.DateFormatter('%Y-%m-%d') ax.format_ydata = lambda x: '$%... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | story645 |
| 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