▪︎ Matplotlib

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()

image.png

▫︎ plt.subplots(행, 열)

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()

image.png

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()

image.png

▫︎ 그래프의 공통 구성 요소