Matplotlib doesn't show proper font on ubuntu 14.04
Question: I installed matplotlib with all dependencies on ubuntu 14.04 from source

    
    
    Processing dependencies for matplotlib==1.3.1
    Searching for nose==1.3.3
    Best match: nose 1.3.3
    Processing nose-1.3.3-py2.7.egg
    Removing nose 1.3.1 from easy-install.pth file
    nose 1.3.3 is already the active version in easy-install.pth
    Installing nosetests script to /usr/local/bin
    Installing nosetests-2.7 script to /usr/local/bin
    Using /usr/local/lib/python2.7/dist-packages/nose-1.3.3-py2.7.egg
    Searching for pyparsing==2.0.1
    Best match: pyparsing 2.0.1
    Adding pyparsing 2.0.1 to easy-install.pth file
    Using /usr/lib/python2.7/dist-packages
    Searching for tornado==3.1.1
    Best match: tornado 3.1.1
    tornado 3.1.1 is already the active version in easy-install.pth
    Using /usr/lib/python2.7/dist-packages
    Searching for python-dateutil==1.5
    Best match: python-dateutil 1.5
    python-dateutil 1.5 is already the active version in easy-install.pth
    Using /usr/lib/python2.7/dist-packages
    Searching for numpy==1.8.1
    Best match: numpy 1.8.1
    numpy 1.8.1 is already the active version in easy-install.pth
    

When i try to plot something matplotlib doesn't show x ticks right as you can
see from here <http://bayanbox.ir/id/4106587232464013527?view>

Source:

    
    
    import matplotlib.pyplot as plt
    import matplotlib
    import pandas as pd
    import numpy as np
    df=pd.DataFrame({'Val': np.random.random(50)})
    df.index=pd.date_range('2000-01-02', periods=50)
    plt.plot_date(df.index.to_pydatetime(), df.Val, fmt='-')
    ax=plt.gca()
    ax.xaxis.set_major_formatter(matplotlib.dates.DateFormatter('%y%b\n%d'))
    plt.show()
    


Answer: Matplotlib uses
[`strftime`](https://docs.python.org/2/library/datetime.html#strftime-and-
strptime-behavior) for working with date formatting in ticks. `strftime` will
use your computer's locale to choose the correct version of certain date
formats, for instance "January" vs "Januar" for English vs German.

Your issue arises because your default language is Persian. Matplotlib is
trying to plot using Persian but is failing at encoding it properly (resulting
in the squares).

Your choices to fix this are to either change the default language of your
computer, or to set the `locale` of your Python code using the
[`locale`](https://docs.python.org/2/library/locale.html) builtin module.

