Pyplot

Jmnote (토론 | 기여)님의 2019년 9월 26일 (목) 01:17 판

1 개요

Pyplot, matplotlib.pyplot
파이플롯

2 화면 출력

Python
Copy
import matplotlib.pyplot as plt
plt.plot([1, 2, 3, 4])
plt.ylabel('some numbers')
plt.show()

Pyploy-some numbers.png

Python
Copy
import numpy as np
import matplotlib.pyplot as plt

x = np.linspace(0,10,1000)
y = np.power(x,2)
plt.plot(x,y)
plt.title('main title')
plt.xlabel('x')
plt.ylabel('y')
plt.show()

Pyplot1-x2.png

3 PDF 파일로 저장

Python
Copy
import numpy as np
import matplotlib.pyplot as plt

x = np.linspace(0,10,1000)
y = np.power(x,2)
plt.plot(x,y)
plt.title('main title')
plt.xlabel('x')
plt.ylabel('y')
plt.savefig('test_plot.pdf')

4 같이 보기

5 참고