Add optional axes-aware text wrapping#31633
Add optional axes-aware text wrapping#31633codegnan-dm wants to merge 5 commits intomatplotlib:mainfrom
Conversation
14d1973 to
d3cadcb
Compare
d3cadcb to
b665ac4
Compare
|
Thank you for your willingness to contribute. Did you intend to link a different issue? The one you linked is not about text in an axes. Also please fill out the PR summary using our template and ensure the tests pass. |
|
⏰ This pull request might be automatically closed in two weeks from now. Thank you for your contribution to Matplotlib and for the effort you have put into this PR. This pull request does not yet meet the quality and clarity standards needed for an effective review. Project maintainers have limited time for code reviews, and our goal is to prioritize well-prepared contributions to keep Matplotlib maintainable. Matplotlib maintainers cannot provide one-to-one guidance on this PR. However, if you ask focused, well-researched questions, a community member may be willing to help. 💬 To increase the chance of a productive review:
As the author, you are responsible for driving this PR, which entails doing necessary background research as well as presenting its context and your thought process. If you are a new contributor, or do not know how to fulfill these requirements, we recommend that you familiarize yourself with Matplotlib's development conventions or engage with the community via our Discourse or one of our meetings before submitting code. If you substantially improve this PR within two weeks, leave a comment and a team member may remove the |
|
Thanks for the feedback. I’ll update the PR summary/template and verify whether the linked issue is correct. I’ll also investigate the failing tests and push fixes shortly. |
|
@rcomer Thank you for the clarification. I have opened a new issue #31635 |
|
The |
|
The AppVeyor Windows CI failure is an infrastructure issue — micromamba |
|
@rcomer Thanks for the clarification. I understand the current behavior is consistent with the documented implementation of set_wrap. I’ve updated the PR to frame this as an optional axes-aware wrapping enhancement while preserving existing default behavior for backward compatibility. |
|
@codegnan-dm before taking this PR further, please could you open an issue feature request describing your use case? I.e., what do you use Matplotlib for and why do you want this? |
Summary
When
wrap=Trueis used on text inside an axes, the wrapping incorrectlyused the figure boundary instead of the axes boundary. This caused text
to overflow outside its axes into adjacent axes or outside the figure.
This fix checks whether the text object belongs to an axes, and if so,
uses the axes boundary for wrapping. Otherwise it falls back to the
figure boundary.
Fixes
Closes #[correct issue number here]
PR Checklist
AI Disclosure
This PR was developed with AI assistance for guidance on code location
and fix approach. The implementation, testing, and verification were
done manually.