As the title states, subplots with equal aspect ratio drift around within the figure when the canvas is redrawn with figure.autolayout set. The following code demonstrates the issue
The issue doesn't appear to occur with the default figure size, but if you resize the window horizontally the subplots drift around with each redraw until eventually settling on a position.
Platform: Windows 7
matplotlib: 1.5.3
python: 2.7.12
Interesting. There is obviously some coupled constraints here as the tight_layout code is trying to resize the axes to fill as much of the figure as possible and the equal aspect is trying to resize them so that the ratio between x/y is fixed in both data and screen space. We apply these constraints in sequence and they have now knowledge of each other.
Calling draw is apparently running a steps of an iterative optimization!
Yes, aspect-ratio handling and tight_layout are essentially hacks developed independently to solve two different problems in the absence of any integrated layout system, and in the context of the existing paradigm with most positioning being done in normalized coordinates.
This issue has been marked "inactive" because it has been 365 days since the last comment. If this issue is still present in recent Matplotlib releases, or the feature request is still wanted, please leave a comment and this label will be removed. If there are no updates in another 30 days, this issue will be automatically closed, but you are free to re-open or create a new issue if needed. We value issue reports, and this procedure is meant to help us resurface and prioritize issues that have not been addressed yet, not make them disappear. Thanks for your help!
For simple systems layout='compressed' helps a lot with this issue. For more complex systems you probably need to do the layout by hand. I'd vote to close this.
This issue has been marked "inactive" because it has been 365 days since the last comment. If this issue is still present in recent Matplotlib releases, or the feature request is still wanted, please leave a comment and this label will be removed. If there are no updates in another 30 days, this issue will be automatically closed, but you are free to re-open or create a new issue if needed. We value issue reports, and this procedure is meant to help us resurface and prioritize issues that have not been addressed yet, not make them disappear. Thanks for your help!
I'm going to close this as no-action. This is an unintended, but mostly harmless, interaction between two systems that adjust the layout late in the draw cycle. For back-compatibility reasons we really can not make siginifacnt changes to either and as Jody notes, layout='constrained' works correctly in this case:
Activity
tacaswell commented on Dec 20, 2016
Interesting. There is obviously some coupled constraints here as the tight_layout code is trying to resize the axes to fill as much of the figure as possible and the equal aspect is trying to resize them so that the ratio between x/y is fixed in both data and screen space. We apply these constraints in sequence and they have now knowledge of each other.
Calling draw is apparently running a steps of an iterative optimization!
efiring commented on Dec 20, 2016
Yes, aspect-ratio handling and tight_layout are essentially hacks developed independently to solve two different problems in the absence of any integrated layout system, and in the context of the existing paradigm with most positioning being done in normalized coordinates.
github-actions commented on Apr 4, 2023
This issue has been marked "inactive" because it has been 365 days since the last comment. If this issue is still present in recent Matplotlib releases, or the feature request is still wanted, please leave a comment and this label will be removed. If there are no updates in another 30 days, this issue will be automatically closed, but you are free to re-open or create a new issue if needed. We value issue reports, and this procedure is meant to help us resurface and prioritize issues that have not been addressed yet, not make them disappear. Thanks for your help!
jklymak commented on Apr 4, 2023
For simple systems layout='compressed' helps a lot with this issue. For more complex systems you probably need to do the layout by hand. I'd vote to close this.
github-actions commented on Apr 5, 2024
This issue has been marked "inactive" because it has been 365 days since the last comment. If this issue is still present in recent Matplotlib releases, or the feature request is still wanted, please leave a comment and this label will be removed. If there are no updates in another 30 days, this issue will be automatically closed, but you are free to re-open or create a new issue if needed. We value issue reports, and this procedure is meant to help us resurface and prioritize issues that have not been addressed yet, not make them disappear. Thanks for your help!
tacaswell commented on Apr 5, 2024
I'm going to close this as no-action. This is an unintended, but mostly harmless, interaction between two systems that adjust the layout late in the draw cycle. For back-compatibility reasons we really can not make siginifacnt changes to either and as Jody notes, layout='constrained' works correctly in this case:
In summary: