python(22) Matplotlib

hyukstory·2020년 8월 28일
0

python

목록 보기
28/35

파이썬의 대표 시각화 도구 - Matplotlib

import matplotlib.pyplot as plt

plt.figure
plt.plot([1,2,3,4,5,6,7,8,9,8,7,6,5,4,3,2,1,0])
plt.savefig('C:/Users/student/Desktop/python/P_4week/plot.png')
plt.show()


import numpy as np
t = np.arange(0,12,0.01)
y = np.sin(t)
plt.figure(figsize = (10,6))
plt.plot(t, y)
plt.show()





plt.figure(figsize=(10,6))
plt.plot(t, y)
plt.grid()
plt.xlabel('time')
plt.ylabel('Amplitude')
plt.title('예시')
plt.savefig('C:/Users/student/Desktop/python/P_4week/plot.png')
plt.show()



plt.figure(figsize=(10,6))
plt.plot(t, np.sin(t), label='sin')
plt.plot(t, np.cos(t), label='cos')
plt.grid()
plt.legend()
plt.xlabel('time')
plt.ylabel('Amplitude')
plt.title('Example of sinewave')
plt.show()



plt.figure(figsize=(10,6))
plt.plot(t, np.sin(t), lw=3, label='sin')  # lw : 굵기
plt.plot(t, np.cos(t), 'r', label='cos')   # r : 빨간색
plt.grid()
plt.legend()
plt.xlabel('time')
plt.ylabel('Amplitude')
plt.title('Example of sinewave')
plt.show()
profile
문돌이의 고군분투 개발 공부

0개의 댓글