Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Bug]: Add native RTL (right-to-left) text rendering support for Hebrew and Arabic #30557

@MAVERICK2025692

Description

@MAVERICK2025692

Bug summary

Description:
Currently, when plotting with Hebrew or Arabic text in Matplotlib, the text is rendered incorrectly from left to right instead of right to left.
Users are required to manually integrate third-party libraries such as python-bidi and arabic_reshaper in order to display RTL text correctly.

This is inconvenient and creates extra friction for users working with RTL languages.

Suggested improvement:

Add built-in support for RTL text rendering (especially for Hebrew and Arabic).

Matplotlib should automatically detect text direction and render it accordingly, without requiring external preprocessing.

Ideally, both labels (axes, legends, titles) and annotations should display correctly out-of-the-box.

Benefit:
This will make Matplotlib more accessible for Hebrew/Arabic speakers and align with how other visualization libraries (and modern UI toolkits) handle RTL scripts automatically.

Code for reproduction

import matplotlib.pyplot as plt

plt.figure()
plt.plot([1,2,3], [1,4,9], label="קריירה")
plt.title("זוגיות ובריאות")
plt.xlabel("שנה")
plt.ylabel("עוצמה")
plt.legend()
plt.show()

Actual outcome

Hebrew text is rendered left-to-right instead of right-to-left.

For example:

"קריירה" appears as "הרייקר".

"זוגיות ובריאות" appears reversed, with characters disconnected.

This affects titles, axis labels, legends, and annotations.

Expected outcome

Hebrew (and other RTL languages such as Arabic) should be rendered in correct right-to-left direction, with characters connected properly.

Example: "קריירה" should appear exactly as written, without needing external preprocessing (e.g., python-bidi, arabic_reshaper).

Additional information

No response

Operating system

No response

Matplotlib Version

Matplotlib version: 3.9.2 (installed via pip) Python version: 3.11 Platform: Windows 10 64-bit

Matplotlib Backend

No response

Python version

No response

Jupyter version

No response

Installation

None

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Waiting for other PR

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions