'How to make Hebrew RTL in matplotlib X axis?

I've been trying to plot grouped data and so far all goes well. However, I plot along the X axis with Hebrew text and it comes out Left-To-Right instead of Right-To-Left which makes it really unreadable. Here is an example plot I did:

The text I wanna convert from LTR to RTL is marked with a red circle

Basically, I group the data by columns [x,y] for example, and matplotlib plots according to those column names, as desired. But I want to know if there is a way to turn the test as desired to RTL. Here is some code to show how I group the data and plot it:

def plot_grouped_data(DataFrame, columns, n_first, ascending = True):
if(ascending):
    Grouped_data = DataFrame.groupby(by = columns).Price.sum().nlargest(n = n_first)
else:
    Grouped_data = DataFrame.groupby(by = columns).Price.sum().nsmallest(n = n_first)
    
Grouped_data.plot(kind = "bar", figsize = (23, 8), fontsize = 14)
plt.ylabel("Sum of car price", fontsize = 16)
plt.show()

I've been trying to find an answer for this online, yet found none. Is there a way to flip the test as desired?



Solution 1:[1]

So, on the basis it cant be done in this manner: My work around is to make a dedicated template for each data set. Seems to defeat the object of having a template. Anyway, I am building the data and templates from a bespoke php and mysql backend.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 andygozindy