5

I used all the correct encoding and the software does work but the letters in Arabic aren't connected (most Arabic letters are connected when written next to each other)

This is how the plot shows the image

I used the python Pandas module using the bar chart function

eyllanesc
  • 235,170
  • 19
  • 170
  • 241
Wonder Hunder
  • 55
  • 2
  • 7
  • 1
    Please avoid links to a foreign site. Instead try giving the actual image here. – 0xInfection Jan 06 '19 at 18:41
  • 2
    @InfectedDrake Sorry if it bothered you, I can't actually, stackoverflow does not allow uploading images unless I'm at a certain reputation score. The site I linked to is actually stackoverflow itself – Wonder Hunder Jan 06 '19 at 18:43
  • Check out the `arabic_reshaper` python package: https://github.com/mpcabd/python-arabic-reshaper – Peter Leimbigler Jan 06 '19 at 20:55
  • @PeterLeimbigler Awesome package, it seems to be working in most situations but trying to plot the series with Pandas it seems to mess it up to be just gibberish. I'll continue searching – Wonder Hunder Jan 07 '19 at 21:26

1 Answers1

1

The only way I could get around this is to take all the Arabic words in the pandas column that I need to plot and reshape it with arabic_reshaper, append them to a list and have this list as my x axis:

# 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)))

Of course you need to install the arabic_reshaper and the bidi.algorithm packages first

krismath
  • 1,879
  • 2
  • 23
  • 41