# Google Colab matplotlib 한글 폰트 오류 문제 해결
# colab과 google Drive 연동을 위한 인증 및 네트워크 디렉토리 마운트
from google.colab import auth
auth.authenticate_user()
from google.colab import drive
drive.mount('/content/drive')
# 1. 나눔 폰트 다운
!sudo apt-get install -y fonts-nanum
!sudo fc-cache -fv
!rm ~/.cache/matplotlib -rf
# 2. 런타임 다시 시작

# 3. matplotlib의 폰트를 Nanum 폰트로 지정
import matplotlib.pyplot as plt
plt.rc('font', family='NanumBarunGothic')
# 이하 실행하여 확인해보세요
# 162p:
# import matplotlib.pyplot as plt
# # 코드내에 삽입
# plt.rc('font', family='NanumBarunGothic')
x = ['Mon', 'Tue', 'Wed', 'Thur', 'Fri', 'Sat', 'Sun']# 문자열
y = [13, 16, 15, 18, 16, 17, 16]
plt.plot(x, y);
plt.xlabel('날짜')
plt.ylabel('No. of Books Sold');
반응형
'교육 > 파이썬빅데이터분석교육' 카테고리의 다른 글
[파이썬]8.1 DNA 프로젝트 (0) | 2022.05.30 |
---|---|
[파이썬]교통사고데이터 분석예제 (0) | 2022.05.26 |
파이썬 Matplotlib 튜터리얼 (0) | 2022.05.24 |
Numpy-예제1출생아수-평균구하기(답) (0) | 2022.05.19 |
Numpy 예제1_출생아수 평균구하기(문제) (0) | 2022.05.19 |