인프런 커뮤니티 질문&답변
그래프에 한글제목을 나타내고 싶습니다.
작성
·
516
답변 1
0
박조은
지식공유자
안녕하세요.
한글폰트 설정이 안 되었네요.
다음의 코드를 시각화 윗쪽 셀에 추가하고 실행해 준 다음에 해당 시각화 코드를 실행해 보세요.
def get_font_family():
"""
시스템 환경에 따른 기본 폰트명을 반환하는 함수
"""
import platform
system_name = platform.system()
# colab 사용자는 system_name이 'Linux'로 확인
if system_name == "Darwin" :
font_family = "AppleGothic"
elif system_name == "Windows":
font_family = "Malgun Gothic"
else:
# Linux
!apt-get install fonts-nanum -qq > /dev/null
!fc-cache -fv
import matplotlib as mpl
mpl.font_manager._rebuild()
findfont = mpl.font_manager.fontManager.findfont
mpl.font_manager.findfont = findfont
mpl.backends.backend_agg.findfont = findfont
font_family = "NanumBarunGothic"
return font_family
plt.rc("font", family=get_font_family())
plt.rc("axes", unicode_minus=False)





추가했는데도 사진처럼 오류가 나요...
뭐가 문젠지 모르겠어요 도와주세요 ㅠ