
1. Matplotlib
- 그래프를 그려주는 라이브러리의 한 종류
- line, scatter, bar, pie, histogram
1.1. 데이터 시각화
- 광범위하게 분산된 방대한 양의 자료(복잡한 데이터)를 한 눈에 볼 수 있도록 도표화 및 차트화
- 시각화를 통해 데이터 특징 파악이 쉽고, 분석 결과를 상대방에게 효율적으로 전달 가능
import numpy as np
import pandas as pd
from matplotlib import pyplot as plt
1.2. 차트 속성들




1.3. line chart
1.3.1. y축 line chart
y = [2, 4, 6, 8]
plt.plot(y)
plt.show()

1.3.2. x와 y축 line chart
x = [1,2,3,4]
y = [1,5,8,9]
plt.plot( x, y,
ls = ':', c = 'red', marker='d', lw=3, mfc='b')
plt.show()

1.4. line chart 실습해보기
matplotlib 한글이 깨질 때 한글 인코딩 하는 방법
from matplotlib import rc
rc('font', family : = 'Malgun Gothic')
x = np.arange(8)
y = [5,2,3,6,8,7,5,7]
plt.plot(x,y, ls = '-.', lw = 5, c='#32CD32',
marker='$♧$', ms="25", mfc='w', mew=3, mec='c')
plt.xlim(-2, 10)
plt.ylim(-4, 12)
plt.grid()
plt.yticks(range(-4,12,1))
plt.show()

1.5. 여러 개의 차트를 하나의 공간에 그려보기
x = np.arange(1,5,1)
y = np.arange(2,9,2)
z = np.arange(3,13,3)
plt.plot(x, label='x데이터')
plt.plot(y, label='y데이터')
plt.plot(z, label='z데이터')
plt.legend()
plt.title('Chart')
plt.xlabel('x축')
plt.ylabel('y축', rotation=0)
plt.show()
