I am trying to use a different font for plots, there are many answers on this but none of them seem to work. In all cases, there is no error, and the default font is used indifferent to my choice. Here are some things I've tried:
- Changing globally
from matplotlib import pyplot as plt
plt.rcParams["font.family"] = "Times New Roman"
plt.title('Title')
plt.show()
- Changing "locally"
csfont = {'fontname': 'Times New Roman'}
plt.title('Title', **csfont)
plt.show()
- Updating params (the other parameters in params update just fine here)
params = {'axes.labelsize': 18, 'axes.titlesize': 20, 'font.family': 'Times New Roman', 'legend.fontsize': 20, 'xtick.labelsize': 28, 'ytick.labelsize': 40}
plt.rcParams.update(params)
plt.title('Title')
plt.show()
This is driving me crazy, any ideas are greatly appreciated.
Edit:
I checked which fonts I have by doing
matplotlib.font_manager.findSystemFonts(fontpaths=None, fontext='ttf')"
I don't think I see fonts like Times New Roman, Helvetica, etc. in here. But when I take one from this list, (e.g. NotoSerifHebrew-Regular), I get a warning
findfont: Font family ['NotoSerifHebrew-Regular'] not found. Falling back to DejaVu Sans.
But when I run the same line again, I no longer get this warning