Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

Closed
Balthasar-eu wants to merge 3 commits into matplotlib:main from Balthasar-eu:main

Conversation

Copy link

@Balthasar-eu Balthasar-eu commented Sep 24, 2024
edited
Loading

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

This commit changes the mutation_aspect from only affecting the y axis to affecting x and y axis in the correct ratio.
Copy link

@github-actions github-actions bot left a 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.

Copy link
Author

Balthasar-eu commented Sep 24, 2024
edited
Loading

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.

@Balthasar-eu Balthasar-eu changed the title (削除) Fix mutation_aspect (削除ここまで) (追記) Fix mutation_aspect incorrectly scaling FancyBbox (追記ここまで) Sep 24, 2024
Copy link
Member

timhoffm commented Oct 7, 2024

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. 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers

@github-actions github-actions[bot] github-actions[bot] left review comments

Assignees
No one assigned
Labels
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

[Bug]: mutation_aspect for FancyBboxPatch does wrong scaling

AltStyle によって変換されたページ (->オリジナル) /