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
'언어 꿀Tip > Python 꿀tip!' 카테고리의 다른 글
07_01_39. matplotlib 그래프 이중축 graph 생성 및 축이름 (0) | 2021.05.27 |
---|---|
07_01_38. pivot_table index를 column으로 (index to column) (0) | 2021.05.27 |
07_01_34. category 변수 다루기, handling (0) | 2021.04.28 |
07_01_33. 한번에 lag 여러개 생성 (0) | 2021.04.26 |
07_07_32. group별로 ts time series 한번에 만들기 (0) | 2021.04.26 |