Skip to content

Fixed right-to-left text that starts with a Latin word bug - #32537

Closed
natpil wants to merge 1 commit into
matplotlib:mainfrom
natpil:edits
Closed

natpil wants to merge 1 commit into
matplotlib:mainfrom
natpil:edits

Conversation

@natpil

@natpil natpil commented Oct 24, 2026

Copy link
Copy Markdown

Added functions to allow the user to rewrite a message with English and Arabic/Urdu text and have it be written from right to left.

PR summary

Closes #32511

Notes: I initially just created a function that reverses the string entirely; however, this did not make sense for sentences with more than one Arabic word next to each other since they are already read right to left. The code I have posted make sure that phrases are kept together and that if the direction of a sentence is switched, the rewritten version makes sense.

AI Disclosure

ChatGPT was used to assist with the writing of one of the functions. The rest was written without any assistance of generative AI.

PR quality check

  • [x ] Use an expressive title, e.g. "Fix title font property precedence"
  • [ x] New and changed code is tested
  • [ x] Plotting related features are demonstrated in an example
  • [ x] New features and API changes have release notes
  • [ x] Documentation complies with general and docstring guidelines

message and have it be written from right to left
if they want. The functions make sure that phrases
are kept together and that if the direction of a
sentence is switched, the rewritten version makes
sense.
@github-actions

Copy link
Copy Markdown

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. We also ask that you please finish addressing any review comments on this PR and wait for it to be merged (or closed) before opening a new one, as it can be a valuable learning experience to go through the review process.

You can also join us on discourse chat for real-time discussion.

For details on testing, writing docs, and our review process, please see the developer guide.
Please let us know if (and how) you use AI, it will help us give you better feedback on your PR.

We strive to be a welcoming and open project. Please follow our Code of Conduct.

@rcomer

rcomer commented Oct 25, 2026

Copy link
Copy Markdown
Member

Hi @natpil and thank you for your interest in contributing to Matplotlib! However, adding a python file in the root of the repository like this does not really do anything. For the functions to be directly importable by users they would need to be in the relevant modules under lib/matplotlib. Alternatively, if your aim is to create an example in the documentation for users to copy it would need to be under galleries/examples.

For this particular issue, the original poster stated they intend to make a PR and they are just waiting for feedback on their proposed approach. So I am going to close this here. You are welcome to open further PRs, but please have a look at our contributors’ guide which has detailed guidance about what goes where and how to test that your contributions do as you expect.
https://matplotlib.org/devdocs/devel/index

@rcomer rcomer closed this Oct 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Right-to-left text that starts with a Latin word is laid out left-to-right

2 participants