✳ Matplotlib¶

✅ 데이터 시각화¶

▶ pyplot¶

  • sin 함수
In [5]:
import numpy as np
import matplotlib.pyplot as plt

# init data
x = np.arange(0, 6 , 0.1)
y = np.sin(x)

# draw graph
plt.plot(x, y)
plt.show()
  • cos 함수
In [10]:
y1 = np.sin(x)
y2 = np.cos(x)

# draw graph
plt.plot(x, y1, label="sin")
plt.plot(x, y2, linestyle="--", label="cos")
plt.xlabel("x")
plt.ylabel("y")
plt.title('sin & cos')
plt.legend()
plt.show()
  • image
In [15]:
from matplotlib.image import imread
img = imread('./test_image.jpg')

plt.imshow(img)
plt.show()