Closed iDTer closed 1 year ago
Or how can I set the ['serif'] to ['sans serif']?
Thank you for any help!!!
This may be because you don't install the corresponding font.
I use matplotlib-3.5.2, and then meet similar problem with you:
findfont: Font family ['serif'] not found. Falling back to DejaVu Sans.
findfont: Generic family 'serif' not found because none of the following families were found: Times
I solve the problem by install the needed font 'Times'. I download the .ttf file from https://www.dafontfree.net/times-regular/f145546.htm and copy it to 'my_python_path/site-packages/matplotlib/mpl-data/fonts/ttf/'. After that, I delete the cache of matplotlib, which could be found by
import matplotlib
matplotlib.get_cachedir()
I hope it would be helpful for you : )
You can use the following code to avoid warning in win10 without calling latex.
plt.style.use(['science', 'ieee', 'no-latex'])
matplotlib.rc('font', family='times new roman')
Thank you everyone for the contribution. Closing as resolved, since no more reports of the problem were made, I assume it did work.
os: win10 SciencePlots v1.0.9 matplotlib 3.3.0 python 3.8
I have put the NotoSerifSC fonts into "..\site-packages\matplotlib\mpl-data\fonts\ttf" and also try the following command:
import matplotlib.font_manager as fm fm._rebuild()
but still report "findfont: Font family ['serif'] not found. Falling back to DejaVu Sans.".