Description
Edit: This description was written when this was still considered an enhancement request. It turned out that the feature in question already is available, but in certain circumstances doesn't work correctly.
Problem
This is an extension of #28673. The problem is that once a user has request set_aspect("equal")
, there is no good API left to further refine the axis limit, i.e. to pan and more importantly, zoom the plot. I believe there is room for improvement here.
The request a user may have is: "set X limits to the specified values, and give me some Y limits which respect the aspect ratio" (you may obviously swap X and Y here). The problem matplotlib has is that this request leaves one degree of freedom ambiguous, with no help from the user to choose - so currently, matplotlib refuses to follow-up on that request. But the problem the user has is that conversely, there is no API to help matplotlib here to specify just that one degree of freedom (typically, the implied request is: "keep the middle in the middle"). The only option left to the user is to discard the request for equal aspect, supply two degrees of freedom and painstakingly do the aspect computations temselves as shown in the workaroung in a comment to the previous issue by @kjayawar.
Perhaps we could come up with a suitable API here? Say, fix the X axis limits and specify the Y coordinate of the centre? Or specify axis limits for either or both dimensions, and allow the user to opt-in for either cropping or extending one of the two if needed while keeping the middle in the centre?
Proposed solution
No response