title: How to display non-English fonts in matplotlib and networkx?
body: <p>This is a followup question to this <a href="https://stackoverflow.com/questions/18772950/right-to-left-support-in-python-networkx-and-matplotlib">question</a>. Since it addresses a more general issue I make it a new question.</p>
  
  <p>I have a network for which the labels of the nodes are in Farsi language (Arabic alphabet). When I try to use <code>networkx</code> to display my network it shows blank squares instead of Arabic letters. Below I copy a good example provided in the answers in <a href="https://stackoverflow.com/questions/18772950/right-to-left-support-in-python-networkx-and-matplotlib">here</a>.</p>
  
  <pre><code>from bidi.algorithm import get_display
  import matplotlib.pyplot as plt
  import arabic_reshaper
  import networkx as nx
  
  # Arabic text preprocessing 
  reshaped_text = arabic_reshaper.reshape(u'زبان فارسی')
  artext = get_display(reshaped_text)
  
  # constructing the sample graph
  G=nx.Graph()
  G.add_edge('a', artext ,weight=0.6)
  pos=nx.spring_layout(G) 
  nx.draw_networkx_nodes(G,pos,node_size=700)
  nx.draw_networkx_edges(G,pos,edgelist=G.edges(data=True),width=6)
  
  # Drawing Arabic text
  # Just Make sure your version of the font 'Times New Roman' has Arabic in it. 
  # You can use any Arabic font here.
  nx.draw_networkx_labels(G,pos,font_size=20, font_family='Times New Roman')
  
  # showing the graph
  plt.axis('off')
  plt.show()
  </code></pre>
  
  <p>which generates the following image:</p>
  
  <p><a href="https://i.stack.imgur.com/Joxk2.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Joxk2.png" alt="enter image description here"></a></p>
  
  <p>I tried to install the needed fonts by following command lines in python, but I get the same thing.</p>
  
  <pre><code>&gt;&gt;&gt; import matplotlib.pyplot
  &gt;&gt;&gt; matplotlib.rcParams.update({font.family' : 'TraditionalArabic'})
  </code></pre>
  
  <p>Here is the ERROR message, to be more specific:</p>
  
  <pre><code>/usr/local/anaconda3/lib/python3.5/site-packages/matplotlib/font_manager.py:1288: UserWarning: findfont: Font family ['TraditionalArabic'] not found. Falling back to Bitstream Vera Sans
    (prop.get_family(), self.defaultFamily[fontext])
  </code></pre>
  
  <p>I am also investigating ways to install the needed fonts from ubuntu cli, if possible, and put it in my docker file as it gets installed every time I spin my runs. </p>
  
  <p>Best regards, s.</p>