阿拉伯字母在图中未正确显示

问题描述 投票:2回答:1

我使用了所有正确的编码,并且该软件可以正常工作,但是阿拉伯字母未连接(大多数阿拉伯字母彼此相邻时已连接)

这是情节显示图像的方式

“”

我使用条形图功能使用python Pandas模块

python pandas arabic letter
1个回答
0
投票

唯一可以解决此问题的方法是,将需要绘制的Pandas列中的所有阿拉伯语单词用arabic_reshaper进行绘制和整形,并将它们附加到列表中,并将此列表作为x轴:

# reshaping the arabic words to show correctly on matplotlib

import arabic_reshaper
import matplotlib.pyplot as plt
from bidi.algorithm import get_display

x = [ ]

for item in df.column_name.values:
    x.append(get_display(arabic_reshaper.reshape(item)))

当然,您需要先安装arabic_reshaperbidi.algorithm软件包

© www.soinside.com 2019 - 2024. All rights reserved.