import matplotlib
import matplotlib.pyplot as plt # matplotlib의 서브 패키지
matplotlib.__version__
# Windows에서 한글 폰트 설정
plt.rcParams['font.family'] = 'Malgun Gothic' # '맑은 고딕'이 설치되어 있을 경우
plt.rcParams['axes.unicode_minus'] = False # 마이너스(-) 부호 깨짐 방지
# macOS에서 한글 폰트 설정
plt.rcParams['font.family'] = 'AppleGothic' # macOS 기본 한글 폰트
plt.rcParams['axes.unicode_minus'] = False
plt.plot()x = [1,2,3,4,5]
y = [10,14,19,23,25]
plt.plot(x,y)
plt.show()
plt.savefig("test_graph.png") : 이미지를 파일로 저장plt.tight_layout() : 그래프 간격 자동 조정
plt.subplots(행, 열)figure : 여러 그래프가 그려지는 최상위 컨테이너
axes : 실제 그래프가 그려지는 공간
axis : 그래프의 축
행과 열을 입력하지 않으면 하나의 figure와 하나의 axes를 만듦
1행 2열의 axes 생성
fig, axs = plt.subplots(1,2)
axs[0].plot([1,2,3], [1,2,3])
axs[1].plot([1,2,3], [1,4,9])
plt.show()

fig, axs = plt.subplots(2,2)
axs[0,0].plot([1,2,3], [1,2,3])
axs[0,1].plot([1,2,3], [1,4,9])
axs[1,0].plot([1,2,3], [3,2,1])
axs[1,1].plot([1,2,3], [9,4,1])
plt.show()
