-
-
Notifications
You must be signed in to change notification settings - Fork 8k
Fix mutation_aspect incorrectly scaling FancyBbox #28877
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This commit changes the mutation_aspect from only affecting the y axis to affecting x and y axis in the correct ratio.
@github-actions
github-actions
bot
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for opening your first PR into Matplotlib!
If you have not heard from us in a week or so, please leave a new comment below and that should bring it to our attention. Most of our reviewers are volunteers and sometimes things fall through the cracks.
You can also join us on gitter for real-time discussion.
For details on testing, writing docs, and our review process, please see the developer guide
We strive to be a welcoming and open project. Please follow our Code of Conduct.
I did not test this on the branch I commit from, but I used this code:
def get_path(self): """Return the mutated path of the rectangle.""" boxstyle = self.get_boxstyle() m_aspect = math.sqrt(self.get_mutation_aspect()) # Call boxstyle with y, height squeezed by aspect_ratio. path = boxstyle( self._x * m_aspect, self._y / m_aspect, self._width * m_aspect, self._height / m_aspect, self.get_mutation_scale(), ) return Path( path.vertices * [1 / m_aspect, m_aspect], path.codes, ) FancyBboxPatch.get_path = get_path
And on top of the code in the linked issue and the resulting plot is the second plot on that issue.
As discussed in the issue #28876, the behavior is consistent, reasonably documented (after #28900) and suits common usage patterns. Therefore, we don't want to introduce a breaking change through changing the behavior.
@Balthasar-eu anyway thanks for your contribution. While your PR did not make it, it lead to an improvement in our docs. 🎉
Uh oh!
There was an error while loading. Please reload this page.
This commit changes the mutation_aspect from only affecting the y axis to affecting x and y axis in the correct ratio.
A demonstration is in the linked issue.
closes #28876
PR summary
PR checklist