Title: DOC: Best practice when to use ax.set_thing(foo) vs ax.set(thing=foo) · Issue #28693 · matplotlib/matplotlib · GitHub
Open Graph Title: DOC: Best practice when to use ax.set_thing(foo) vs ax.set(thing=foo) · Issue #28693 · matplotlib/matplotlib
X Title: DOC: Best practice when to use ax.set_thing(foo) vs ax.set(thing=foo) · Issue #28693 · matplotlib/matplotlib
Description: Documentation Link No response Problem Inspired through the discussion at #28677 (comment): Through #20569 we have made Artist.set() more useable. In particular, we have started to Axes.set() in some places in the documentation. We curre...
Open Graph Description: Documentation Link No response Problem Inspired through the discussion at #28677 (comment): Through #20569 we have made Artist.set() more useable. In particular, we have started to Axes.set() in so...
X Description: Documentation Link No response Problem Inspired through the discussion at #28677 (comment): Through #20569 we have made Artist.set() more useable. In particular, we have started to Axes.set() in so...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/28693
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"DOC: Best practice when to use ax.set_thing(foo) vs ax.set(thing=foo)","articleBody":"### Documentation Link\r\n\r\n_No response_\r\n\r\n### Problem\r\n\r\nInspired through the discussion at https://github.com/matplotlib/matplotlib/pull/28677#discussion_r1708863650: Through #20569 we have made `Artist.set()` more useable. In particular, we have started to `Axes.set()` in some places in the documentation.\r\n\r\nWe currently do not have a best practice when to `ax.set_thing(foo)` vs `ax.set(thing=foo)`.\r\n\r\n### Suggested improvement\r\n\r\nWe should have a best practive when to use what that we document, teach and use in our docs.\r\n\r\nThere was a loose discussion at https://github.com/matplotlib/ProjectManagement/blob/b9b0a56cb7b329c3c2adfac77a84975f70868e24/meeting_notes/2021/q2.md#do-we-want-to-soup-up-and-advertise-objset-more, but no definitive solution.\r\n\r\nGeneral observations:\r\n- Both APIs are intended to co-exist. We don't plan to get rid of one or the other.\r\n- Advantages of `set_thing()`:\r\n - more specific\r\n - easier to find the docs (for `set(thing=...)` one has to go to `set()` and follow the link for the specific keyword).\r\n - more functionality through kwargs available\r\n- Advantages of `set(thing=...)`:\r\n - shorter\r\n- Neutral\r\n - tab completion should work for both cases (`ax.set_\u003cTAB\u003e` and `ax.set(\u003cTAB\u003e`)\r\n - API is fully documented for both cases (no more `set(**kwargs)` signatures)\r\n - Historically `set_thing` was mostly used and advertized\r\n \r\n\r\nPlease add if you have additional points.\r\n\r\nI'll stop here without suggesting a solution to keep the discussion unbiased. Suggestions for solution should be posted as separte comments.","author":{"url":"https://github.com/timhoffm","@type":"Person","name":"timhoffm"},"datePublished":"2024-08-09T14:09:54.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":3},"url":"https://github.com/28693/matplotlib/issues/28693"}
| 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:d8cb66c7-3082-fecd-c15f-02dec0390da9 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D0DE:1BB279:30832:40FB4:6A51C97A |
| html-safe-nonce | 1c4a3d4403d5b0b91861294fc9af12a94b68080ae52067b3f222b7bf00f5a2b9 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEMERFOjFCQjI3OTozMDgzMjo0MEZCNDo2QTUxQzk3QSIsInZpc2l0b3JfaWQiOiI0ODk5NTM1NjM4OTIyMTE5NTQ2IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | cdc1e696922369c197b5981754eb2e7e67e89bbe46c00c87638968f090a2a870 |
| hovercard-subject-tag | issue:2458015217 |
| 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/28693/issue_layout |
| twitter:image | https://opengraph.githubassets.com/ea17ae4e39663e99210e9a8f8bb86abbf901fe1df7784e09dae4e187c8eab677/matplotlib/matplotlib/issues/28693 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/ea17ae4e39663e99210e9a8f8bb86abbf901fe1df7784e09dae4e187c8eab677/matplotlib/matplotlib/issues/28693 |
| og:image:alt | Documentation Link No response Problem Inspired through the discussion at #28677 (comment): Through #20569 we have made Artist.set() more useable. In particular, we have started to Axes.set() in so... |
| 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 | 7aed05249554b889eb33d002851a973eebcc7e91 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width