I have tried to draw lexicographic graphs with python33 networkx and matplotlib running on Linux Fedora 19 KDE, 64 bits. When feeding English script as input data, the graphs are drawn well. However, when providing Arabic script as input data, all I get is squares queued in juxtaposition. This is an example of a simple graph in English script:
and here is a simple graph of Arabic words written in Arabic script, (which is written from Right-to-left).
The question is: how can I show Arabic script in the graphs that I generate using python networkx and matplotlib.pyplot? I really appreciate your kind help!
Edit: after Chronial suggested selecting the the proper font, I executed these commands in the python33 shell:
>>> import matplotlib.pyplot
>>> matplotlib.rcParams.update({font.family' : 'TraditionalArabic'})
Then I constructed the graph with Arabic words. However, drawing the graph did not show Arabic script. It showed jsut squares. I do not know whether the matplotlib.pyplot uses the system fonts or it has its own font packages. Assuming that the matplotlib.pyplot uses the system font, then it should have shown Arabic scripts. It seems that Arabic fonts needs to be installed to the matplotlib.pyplot. But I don't know how to do that. Your help is highly appreciated!
Edit # 3:
After installing Arabic fonts into the system, I could generate graphs with Arabic script but the script appears from left-to-right. A good progress towards the final stage: which is Arabic script appearing from Right to left. Below is a shot of the graph:
Yours,
Mohammed
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…