leewatson's picture
Upload plot_fonts.py
038bcc6 verified
raw
history blame contribute delete
522 Bytes
# utils/plot_fonts.py
import os
from matplotlib import font_manager, rcParams
def setup_korean_font(project_root, ttf_name="NanumGothic.ttf"):
font_path = os.path.join(project_root, ttf_name)
if os.path.exists(font_path):
font_manager.fontManager.addfont(font_path)
rcParams["font.family"] = font_manager.FontProperties(fname=font_path).get_name()
else:
rcParams["font.family"] = ["NanumGothic", "AppleGothic", "Malgun Gothic", "DejaVu Sans"]
rcParams["axes.unicode_minus"] = False