I have Arial font installed in my system:

    /usr/share/fonts/truetype/msttcorefonts/Arial_Bold_Italic.ttf
    /usr/share/fonts/truetype/msttcorefonts/arialbi.ttf
    /usr/share/fonts/truetype/msttcorefonts/Arial_Bold.ttf
    /usr/share/fonts/truetype/msttcorefonts/arial.ttf
    /usr/share/fonts/truetype/msttcorefonts/ariali.ttf
    /usr/share/fonts/truetype/msttcorefonts/arialbd.ttf
    /usr/share/fonts/truetype/msttcorefonts/Arial.ttf
    /usr/share/fonts/truetype/msttcorefonts/Arial_Italic.ttf
    /usr/share/fonts/truetype/msttcorefonts/Arial_Black.ttf
    /usr/share/xbmc/media/Fonts/arial.ttf
    /usr/local/share/texmf/fonts/tfm/urw/arial
    /usr/local/share/texmf/fonts/afm/urw/arial
    /usr/local/share/texmf/fonts/vf/urw/arial
    /usr/local/share/texmf/fonts/type1/urw/arial

I have changed inside my matplotlibrc including the line:

    font.sans-serif      : Arial

If I check inside IPython:

    import matplotlib.pyplot as plt
    plt.plot([1,2,3,4,5,], '*')
    t = plt.ylabel(r'1, 2, 3, 8, 9 6 11 Testing Label')
    print(t.get_fontname())

The output is:

    myhome/local/lib/python2.7/site-packages/matplotlib-1.4.2-py2.7-linux-
    x86_64.egg/matplotlib/font_manager.py:1279: UserWarning: findfont: Font
    family [u'sans-serif'] not found. Falling back to Bitstream Vera Sans
    (prop.get_family(), self.defaultFamily[fontext]))

    Bitstream Vera Sans

How can I change this behavior and use Arial fonts for all of my plots?
Why Arial font is not loaded?

It is interesting, that if I use Seaborn, it returns `Liberation Sans`
where the first font (inside internal font list) is Arial and the second is
`Liberation Sans`.

I have also tried to set the full path of my Arial font:

    import matplotlib as mpl
    import matplotlib.pyplot as plt
    import matplotlib.font_manager as font_manager
    import seaborn as sns

    path = '/usr/share/fonts/truetype/msttcorefonts/Arial.ttf'
    prop = font_manager.FontProperties(fname=path)
    mpl.rcParams['font.family'] = prop.get_name()


    sns.set_style("whitegrid")
    plt.plot([1,2,3,4,5,], '*')
    t = plt.ylabel(r'1, 2, 3, 8, 9 6 11 Testing Label')
    print(t.get_fontname())

It returns `Liberation Sans`. Any clues? (aka http://goo.gl/V511ux) =]


Cheers,
Arnaldo.
------------------------------------------------------------------------------
New Year. New Location. New Benefits. New Data Center in Ashburn, VA.
GigeNET is offering a free month of service with a new server in Ashburn.
Choose from 2 high performing configs, both with 100TB of bandwidth.
Higher redundancy.Lower latency.Increased capacity.Completely compliant.
http://p.sf.net/sfu/gigenet
_______________________________________________
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to