Title: Consider adding setters and getters associated with all Axes.format features · Issue #63 · proplot-dev/proplot · GitHub
Open Graph Title: Consider adding setters and getters associated with all Axes.format features · Issue #63 · proplot-dev/proplot
X Title: Consider adding setters and getters associated with all Axes.format features · Issue #63 · proplot-dev/proplot
Description: For consistency with the matplotlib API, all of the features implemented in self.format() should be implemented with setters and getters, then the axes can be updated with native Artist.update or Artist.set methods. Also, Axes.format wil...
Open Graph Description: For consistency with the matplotlib API, all of the features implemented in self.format() should be implemented with setters and getters, then the axes can be updated with native Artist.update or A...
X Description: For consistency with the matplotlib API, all of the features implemented in self.format() should be implemented with setters and getters, then the axes can be updated with native Artist.update or A...
Opengraph URL: https://github.com/proplot-dev/proplot/issues/63
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Consider adding setters and getters associated with all Axes.format features","articleBody":"For consistency with the matplotlib API, all of the features implemented in `self.format()` should be implemented with setters and getters, then the axes can be updated with **native** `Artist.update` or `Artist.set` methods. Also, `Axes.format` will redirect to `update` and issue a deprecation warning.\r\n\r\nHere is some background:\r\n\r\n* The matplotlib API uses setters and getters for updating arbitrary abstract `Artist` classes, including the `Axes` class.\r\n* The matplotlib API also has `Artist.set` and `Artist.update` methods for **bulk** updating arbitrary artists. **Example usage**: If an artist has `set_linewidth` and `set_linestyle` methods, then `update` and `set` will accept `linewidth` and `linestyle` as keyword args and pass them to the setter.\r\n* Part of the inspiration for ProPlot was that I found line-by-line property setting to be very inefficient in day-to-day usage, and wanted one function for updating all aspects of the axes. The problems with `Artist.update` and `Artist.set` are:\r\n(1) almost on one uses them (especially with `Axes` artists), (2) they appear seldom in the examples, and (3) there is **no artist-specific documentation** on keyword arguments accepted by these methods, since they work by searching for arbtirary setters with `getattr(self, 'set_' + key)`, so only advanced users will learn how to use them.\r\n\r\nI think it is important for users to be able to modify arbitrary properties of python classes in place without a \"bulk\" function. However, it is also important for the sake of efficiency that users have this \"bulk\" function, and they should be **encouraged** to use the \"bulk\" one in the first place.\r\n\r\nWhere ProPlot can improve this is by **documenting the \"bulk\" function** by scanning the `Axes` attributes and building a numpydoc-style parameter table from the first line of every setter, and allowing people to pass keyword args to arbitrary setters with `{setting}_kw`-style arguments. Every ProPlot example will still use the bulk updater to encourage this for new users.\r\n\r\nA more bold option could be to monkey patch the matplotlib `Artist` class, overriding its `set` and `update` methods so that **every** artist is documented like this. But I think the PR will just start with axes.\r\n","author":{"url":"https://github.com/lukelbd","@type":"Person","name":"lukelbd"},"datePublished":"2019-11-10T19:39:37.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/63/proplot/issues/63"}
| 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:68072f2e-831d-feec-a1f6-2fb307c87ae3 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 999E:9E63:3EC71B:57700E:697B442E |
| html-safe-nonce | 43ae9001b04f00cdfcf0fa7aefbb7f827cd14be3c3a6424c90b20f55d9aceb12 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5OTlFOjlFNjM6M0VDNzFCOjU3NzAwRTo2OTdCNDQyRSIsInZpc2l0b3JfaWQiOiIxNzQ0MjA4MDE3NjM0MzEzMjYyIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | cf826620cda93404de2a49711630255f6459a38f4e0cc31d5c3df8dab573940d |
| hovercard-subject-tag | issue:520646848 |
| 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/proplot-dev/proplot/63/issue_layout |
| twitter:image | https://opengraph.githubassets.com/98b7a20bf0088a47122638ab1ecaf8f0bfd8b8301c2c961fa801caa75e0cb314/proplot-dev/proplot/issues/63 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/98b7a20bf0088a47122638ab1ecaf8f0bfd8b8301c2c961fa801caa75e0cb314/proplot-dev/proplot/issues/63 |
| og:image:alt | For consistency with the matplotlib API, all of the features implemented in self.format() should be implemented with setters and getters, then the axes can be updated with native Artist.update or A... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | lukelbd |
| hostname | github.com |
| expected-hostname | github.com |
| None | 6fe64d94889230be19a900846cfc91707e7dd4206878d6c208922b46a6b0735d |
| turbo-cache-control | no-preview |
| go-import | github.com/proplot-dev/proplot git https://github.com/proplot-dev/proplot.git |
| octolytics-dimension-user_id | 108025793 |
| octolytics-dimension-user_login | proplot-dev |
| octolytics-dimension-repository_id | 113293661 |
| octolytics-dimension-repository_nwo | proplot-dev/proplot |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 113293661 |
| octolytics-dimension-repository_network_root_nwo | proplot-dev/proplot |
| 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 | 35925b5d54d957e7d3b7f55916450a693827ca42 |
| ui-target | canary-1 |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width