Title: [MNT]: API consistency for figsize · Issue #29635 · matplotlib/matplotlib · GitHub
Open Graph Title: [MNT]: API consistency for figsize · Issue #29635 · matplotlib/matplotlib
X Title: [MNT]: API consistency for figsize · Issue #29635 · matplotlib/matplotlib
Description: Summary Split out of #24617. Before we can implement this, we need a though API discussion (#24617 (comment)). Current state: The kwarg figsize is IMHO well named and extremly widely used. It must stay as is. The methods set/get_size_inc...
Open Graph Description: Summary Split out of #24617. Before we can implement this, we need a though API discussion (#24617 (comment)). Current state: The kwarg figsize is IMHO well named and extremly widely used. It must ...
X Description: Summary Split out of #24617. Before we can implement this, we need a though API discussion (#24617 (comment)). Current state: The kwarg figsize is IMHO well named and extremly widely used. It must ...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/29635
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[MNT]: API consistency for figsize","articleBody":"### Summary\n\nSplit out of #24617. Before we can implement this, we need a though API discussion (https://github.com/matplotlib/matplotlib/issues/24617#issuecomment-2662713614).\n\nCurrent state:\n\n- The kwarg `figsize` is IMHO well named and extremly widely used. It must stay as is.\n- The methods `set/get_size_inches()` as also widely used ([90k matches on GitHub](https://github.com/search?q=%2F%5C.set_size_inches%5C%28%2F+NOT+repo%3Amatplotlib%2Fmatplotlib+NOT+is%3Afork\u0026type=code)) and thus cannot be changed\n\nWe have to make a tradeoff decsion here: What is worse the naming inconsisteny (1) or multiple functions doing the same thing (2)?\n\nI'm ok with going with (2), under the condition that `set_figsize()` and `set_size_inches()` as not equal aliases. There should be a clear guidance what to use. In practice that means discouraging `set_size_inches` in favor of `set_figsize()`.\n\nThere's a separate discussion whether `set_figsize()` should accept both two individual parameters as well as one tuple. The tuple is mainly to make `fig.set(figsize=(w, h))` work because that single tuple is forwarded to `set_figsize`, but we could also create API infrastructure that specifies on the setter how multipe parameters can be handled in a set() call, i.e. there would be an internal preprocessing that unpacks the tuple for the `set_figsize` call.\n\nSide-note: I've recently created #29612 to (partially) address the long-standing and much asked-for figure unit topic. One could expand that to `set_figsize()` later.\n\nDiscarded: When moving API anyway, one could consider going with `size` instead of `figsize`. That's shorter and `fig.set_size()` / `plt.figure(size=...)` would work well. However, it would be an even larger API break, and we cannot use that for `plt.subplots(..., size=...)`, because that would be too ambigous. Therefore `subplots(..., figsize=...)` must be kept. While we strictly don't need to have naming equivalence between `subplots()` and `figure` concerning this parameter, overall it's not worth it, so let's stick to `figsize` everywhere.\n\n","author":{"url":"https://github.com/timhoffm","@type":"Person","name":"timhoffm"},"datePublished":"2025-02-17T11:00:15.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/29635/matplotlib/issues/29635"}
| 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:fe9097a7-108a-594c-e2c8-0e1344f8ffe2 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A806:2C9FC7:EBD918:138D9FD:6A532ECB |
| html-safe-nonce | 17df4cfea4cc27577fe6386bc6514e39a4208a507fe2989dcc44e4f65aa81135 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBODA2OjJDOUZDNzpFQkQ5MTg6MTM4RDlGRDo2QTUzMkVDQiIsInZpc2l0b3JfaWQiOiI2OTAwMzAyNTgxMzIwNTkzMDk5IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 4991e55e1613a8d0adefa03553e31a6b106973e23f200c93c601e77f1fcf98e4 |
| hovercard-subject-tag | issue:2857502586 |
| 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/29635/issue_layout |
| twitter:image | https://opengraph.githubassets.com/5936a427ee665aa1952234933bcd008d0583ee19b522398fd5f883d8d91c5f56/matplotlib/matplotlib/issues/29635 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/5936a427ee665aa1952234933bcd008d0583ee19b522398fd5f883d8d91c5f56/matplotlib/matplotlib/issues/29635 |
| og:image:alt | Summary Split out of #24617. Before we can implement this, we need a though API discussion (#24617 (comment)). Current state: The kwarg figsize is IMHO well named and extremly widely used. It must ... |
| 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