[matplotlib] 한글 깨짐 해결

cateto·2021년 11월 23일
0
post-thumbnail

참고 : https://jinyes-tistory.tistory.com/70

[에러메시지]

Font family [] not found. Falling back to DejaVu Sans

  1. 캐쉬 경로를 검색한다.
    matplotlib.get_cachedir()

  2. 해당 캐쉬 경로로 이동, tex.cache 폴더랑 fontList.json 파일 모두 삭제한다.

user@Ubuntu:~/.cache/matplotlib$ ls
fontlist-v310.json  fontlist-v330.json  tex.cache
  1. 런타임 RESTART

  2. 폰트 재설정

# 한글 폰트 사용을 위해서 세팅
import matplotlib.pyplot as plt
import matplotlib as mpl
from matplotlib import font_manager, rc

font_path = "/usr/share/fonts/truetype/nanum/NanumGothic.ttf"
font = font_manager.FontProperties(fname=font_path).get_name()
rc('font', family=font)
  1. 한글 폰트가 깨지지 않고 뜬다 !

profile
Curious for Everything

0개의 댓글