matplotlib 을 사용할 때, 한글 쓰는 방법

 

1. 한글 글꼴 다운 받기 (영리, 비영리 목적 사용 가능한 나눔글꼴 다운로드 [https://hangeul.naver.com/2017/nanum])

  - 윈도우에서 나눔글꼴 모음 설치하기를 다운 받아 실행하면 C:\windows\Fonts\ 디렉토리에 설치 됨

  - 맥에서는 /Library/Fonts 나 사용자 홈 디렉토리에서 ~/Library/Fonts 에 설치

 

2. 가독성의 정석 나눔 고딕 예시

from matplotlib import font_manager
font_path = 'c:/Windows/Fonts/NanumGothic.ttf' # 맥이라면 '/Library/Fonts/NanumGothic.ttf' 또는 '~/Library/Fonts/NanumGothic.ttf'
font_family = font_manager.FontProperties(fname=font_path).get_name()
plt.rcParams["font.family"] = font_family

Posted by 공돌이pooh
,