matplotlib的x轴标签在波斯语言环境“ fa_IR”中以LTR而不是RTL显示文本

问题描述

我绘制了一个dataframe,它的索引由datetimes组成。

我想用波斯语显示月份名称。我将语言环境更改为fa-IR,如下所示:

import locale

locale.setlocale(locale.LC_ALL,'fa_IR')

然后,我scatter dataframe

self.canvas.axes.scatter(df_day.index.values,df_day.loc[:,item],linestyle="None",marker='.')

我还设置了x-axis标签,以缩写形式显示月份名称

self.canvas.axes.xaxis.set_major_locator(matplotlib.ticker.MultipleLocator(0.19))
self.canvas.axes.xaxis.set_major_formatter(mdates.DateFormatter('%d-%b %H:%M'))

这就是我得到的:

enter image description here

月份名称以波斯字母显示,但文本方向为LTR而不是RTL。在波斯语中,文字的方向是RTL。

我希望它成为

enter image description here

代替

enter image description here

如何解决

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)