Q: matplotlib loaded font appears fade on another machine I have a python code using matplotlib which appears fine on a centos7 machine but on another centos7 machine, the font appears fade on the axes and legend:

My font is at /usr/share/fonts/MyFont
I checked that my font appears in
/root/.cache/matplotlib/fontList.cache
I've tried deleting and regenerating it.
def plot(data, format='png', width=400, height=400, font='MyFont'):
    font_size = max(3, int(width / 40))
    plt.cla()
    plt.clf()
    matplotlib.rcParams.update({'font.size': font_size,\
                                'font.family': font})
    fig = plt.figure()
    _width = width / fig.get_dpi()
    _height = height / fig.get_dpi()
    fig.set_size_inches(_width, _height)
    plt.xlabel('this is x axis')
    plt.ylabel('this is y axis')
    plt.legend(bbox_transform=plt.gcf().transFigure, loc=2)
    x = [1,2,3,4]
    y = x
    plt.plot(x, y, color='b', label='line1')
    plt.legend(bbox_transform=plt.gcf().transFigure, loc=2)
    plt.title('this is title', fontweight='bold')


update:
I think the problem is that I have Lato-Hairline.ttf and Lato-Regular.ttf and on one operating system it is taking Regular as the default where on this new machine it is taking Hairline as the default which is so fade.

A: I deleted Lato-HairlineItalic.ttf and Lato-Hairline.ttf and then deleted
/root/.cache/matplotlib/fontList.cache.
It caused matplotlib to pick the other ttf file which is the proper regular form of the font.
I still would like to know how matplotlib determines which font is the regular form (default) such that it is behaviing randomly on different centos machines.
