본문 바로가기
카테고리 없음

[Matplotlib] plot title 한글 깨짐 오류 해결

by 미래미래로 2020. 7. 13.
728x90
반응형

matplotlib.rcParams['font.family'] ='Malgun Gothic'

matplotlib.rcParams['axes.unicode_minus'] =False

 

한글 title을 설정하면 다음과 같이 한글 깨짐 현상이 나타난다. 

 

다음과 같은 오류는 시스템 폰트를 사용하고 있기 때문이고,

이를 해결하려면 폰트를 한글폰트로 지정해주면 된다.

코드는 다음과 같다. 

 

import matplotlib

matplotlib.rcParams['font.family'] ='Malgun Gothic'

matplotlib.rcParams['axes.unicode_minus'] =False

 

위 코드를 실행한 후

다시 plot 하면, 한글로 된 title이 깨지지 않고 잘 나오는 것을 확인할 수 있다. 

 

 

728x90
반응형

댓글