Title: [MNT]: deprecate "which" parameter of `Axes.set_position`? · Issue #31254 · matplotlib/matplotlib · GitHub
Open Graph Title: [MNT]: deprecate "which" parameter of `Axes.set_position`? · Issue #31254 · matplotlib/matplotlib
X Title: [MNT]: deprecate "which" parameter of `Axes.set_position`? · Issue #31254 · matplotlib/matplotlib
Description: Summary As a user, I was always confused by the which parameter of set_position and under what circumstance one might set the active position. The docstring indicates that the original and active positions are usually the same unless a f...
Open Graph Description: Summary As a user, I was always confused by the which parameter of set_position and under what circumstance one might set the active position. The docstring indicates that the original and active p...
X Description: Summary As a user, I was always confused by the which parameter of set_position and under what circumstance one might set the active position. The docstring indicates that the original and active p...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/31254
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[MNT]: deprecate \"which\" parameter of `Axes.set_position`?","articleBody":"### Summary\n\nAs a user, I was always confused by the *which* parameter of `set_position` and under what circumstance one might set the active position. The [docstring](https://matplotlib.org/stable/api/_as_gen/matplotlib.axes.Axes.set_position.html) indicates that the original and active positions are usually the same unless a fixed aspect ratio is set.\n\nLooking through the [code of apply_aspect](https://github.com/matplotlib/matplotlib/blob/829a9cc1da1ed99671eefc52df897f8b178aad91/lib/matplotlib/axes/_base.py#L1943), I think it always updates the active position. Since `apply_aspect` gets called within `draw`, `get_tightbbox` and `get_position`, it's not clear to me that the user can ever effectively set the active position directly, unless they made an axes subclass that replaced `apply_aspect`.\n\n`apply_aspect` itself uses a private `_set_position` that was factored out of `set_position` at #9082. So maybe the existence of the _which_ parameter in the public function is a hangover from before that and is no longer needed.\n\n### Proposed fix\n\nEither deprecate the _which_ parameter in the public method so it only sets the original position, or make it clear in the docstring that setting the active position will almost never be effective.","author":{"url":"https://github.com/rcomer","@type":"Person","name":"rcomer"},"datePublished":"2026-03-07T17:36:48.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":10},"url":"https://github.com/31254/matplotlib/issues/31254"}
| 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:b6ea5a25-1627-a69c-6273-3293555a4bb5 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D4D2:134698:1A9346:23DB9F:6A51D3F8 |
| html-safe-nonce | 665c309708013e59440dfce03fe283908d2a1822a50bd0fdae03038700c70dbf |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJENEQyOjEzNDY5ODoxQTkzNDY6MjNEQjlGOjZBNTFEM0Y4IiwidmlzaXRvcl9pZCI6Ijg3NTI1MDY1MTA0NjA5NjU4ODAiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 9066754b5b99093616c39992c46f9946a4f1312124c409e839fa51de74b6ef2d |
| hovercard-subject-tag | issue:4039020175 |
| 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/31254/issue_layout |
| twitter:image | https://opengraph.githubassets.com/8277c43c3a368509b2caf6e6f72955ccd7e4e50b0e7cf2bbf696e65ba28dd15d/matplotlib/matplotlib/issues/31254 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/8277c43c3a368509b2caf6e6f72955ccd7e4e50b0e7cf2bbf696e65ba28dd15d/matplotlib/matplotlib/issues/31254 |
| og:image:alt | Summary As a user, I was always confused by the which parameter of set_position and under what circumstance one might set the active position. The docstring indicates that the original and active p... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | rcomer |
| 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 | canary-1 |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width