본문 바로가기
데이터분석

Matplotlib에서 한글 폰트 지정하는 방법

by 데이터찻집 2025. 8. 15.
반응형

1. NanumGothic 체

from matplotlib import pyplot as plt
 
plt.rc('font', family='NanumGothic')

housing["income_cat"].value_counts().sort_index().plot.bar(rot=0,grid=True)
 
plt.title("소득 카테고리 별 구역 개수")
plt.xlabel("소득 카테고리")
plt.ylabel("구역 개수")
plt.show()

 

2. Malgun Gothic 체


from
 matplotlib import pyplot as plt
 
plt.rc('font', family='Malgun Gothic')

housing["income_cat"].value_counts().sort_index().plot.bar(rot=0,grid=True)
 
plt.title("소득 카테고리 별 구역 개수")
plt.xlabel("소득 카테고리")
plt.ylabel("구역 개수")
plt.show()

3. NanumMyeongjo 체


from
 matplotlib import pyplot as plt
 
plt.rc('font', family='NanumMyeongjo')

housing["income_cat"].value_counts().sort_index().plot.bar(rot=0,grid=True)
 
plt.title("소득 카테고리 별 구역 개수")
plt.xlabel("소득 카테고리")
plt.ylabel("구역 개수")
plt.show()

 

4. NanumBarunGothic 체


from
 matplotlib import pyplot as plt
 
plt.rc('font', family='NanumBarunGothic')

housing["income_cat"].value_counts().sort_index().plot.bar(rot=0,grid=True)
 
plt.title("소득 카테고리 별 구역 개수")
plt.xlabel("소득 카테고리")
plt.ylabel("구역 개수")
plt.show()

5. 글꼴 사이즈 조정


from
 matplotlib import pyplot as plt
 
plt.rc('font', family='NanumGothic' , size=15)

housing["income_cat"].value_counts().sort_index().plot.bar(rot=0,grid=True)
 
plt.title("소득 카테고리 별 구역 개수")
plt.xlabel("소득 카테고리")
plt.ylabel("구역 개수")
plt.show()

 

 
 
반응형