언어 꿀Tip/Python 꿀tip!
07_01_35. local 환경에서 그래프(graph) 한글 깨짐
늉이늉이
2021. 5. 10. 09:56
local PC 환경에서 그래프 생성시, 범례 혹은 title에서 한글 깨짐 발생 시 해결하고자 한다~
아래 코드를 실행하면, 한글 폰트가 사용 가능해 짐 :)
import platform
import matplotlib
if platform.system() == 'Windows':
matplotlib.rc('font', family = 'Malgun Gothic')
elif platform.system() == 'Darwin':
matplotlib.rc('font', family = 'AppleGothic')
else:
matplotlib.rc('font', family = 'NanumGothic')
matplotlib.rcParams['axes.unicode_minus'] = False