728x90
반응형
[module02]
import random
import numpy as np
import matplotlib.pyplot as plt
def plt01():
x = np.arange(0,11)
y = x
plt.plot(x,y)
plt.xlabel('x')
plt.ylabel('y')
plt.legend(['y=x'])
plt.show()
def plt02():
# i가 아래에서 사용되지 않을때 _를 사용할 수 있음!
y = [random.randint(0,10) for _ in range(10)]
x = range(10)
plt.bar(x,y)
plt.xticks(range(11))
plt.yticks(range(11))
plt.show()
def plt03():
data = [random.randint(100,1000) for _ in range(4)]
plt.pie(data)
category = ['first', 'second', 'third', 'fourth']
plt.legend(category)
[main메소드]
if __name__=='__main__':
#plt01()
#plt02()
plt03()
728x90
반응형
'Language > Python' 카테고리의 다른 글
[python]io_file_r,w,a,x (0) | 2020.10.12 |
---|---|
[python]math_원의 넓이 (0) | 2020.10.12 |
[python]random_랜덤, 로또 (0) | 2020.10.12 |
[python]lambda_람다, 익명함수 (0) | 2020.10.12 |
[python]함수02_구구단 (0) | 2020.10.08 |