1. Nanum Font Install

apt-get install fonts-nanum*Copy Icon

2. matplotlib 경로 확인

print(matplotlib.__file__)Copy Icon

3. Nanum Font copy to matplotlib

cp /usr/share/fonts/truetype/nanum/Nanum* /opt/conda/lib/python3.8/site-packages/matplotlib/mpl-data/fonts/ttf/Copy Icon

4. matplotlib Font cache 삭제

rm -rf ~/.cache/matplotlib/*Copy Icon

5. Font 목록 확인

import matplotlib.font_manager
font_list = matplotlib.font_manager.findSystemFonts(fontpaths=None, fontext='ttf')
[matplotlib.font_manager.FontProperties(fname=font).get_name() for font in font_list if 'Nanum' in font]Copy Icon

6. 폰트 설정

import matplotlib
import matplotlib.pyplot as plt

plt.rc('font', family='NanumSquare')
matplotlib.rcParams['axes.unicode_minus'] = FalseCopy Icon

 

욱근욱