import matplotlib.pyplot as plt
data = [1,2,3,4,3,2,1]
plt.figure('그래프 이름')
plt.plot(data)
plt.show()
import matplotlib.pyplot as plt
x = [10, 20, 30, 40, 50, 60, 70]
y = [1,2,3,4,5,2,1]
plt.figure('그래프 이름')
plt.plot(x,y)
plt.show()
import matplotlib.pyplot as plt
import numpy as np
time = np.arange(0,10,0.01)
y = np.sin(time)
plt.figure('그래프 이름')
plt.plot(time,y)
plt.show()
이 코드의 arange는 0부터 10까지 0.01간격으로 등분
import matplotlib.pyplot as plt
import numpy as np
time = np.arange(0,10,0.01)
sin_y = np.sin(time)
cos_y = np.cos(time)
plt.figure('그래프 이름')
plt.plot(time,sin_y)
plt.plot(time,cos_y)
plt.show()
import matplotlib.pyplot as plt
import numpy as np
time = np.arange(0,10,0.01)
sin_y = np.sin(time)
cos_y = np.cos(time)
plt.figure('sin, cos 그래프')
plt.plot(time,sin_y, label='sin')
plt.plot(time,cos_y,label='cos')
plt.legend() #범례
plt.xlabel('time')
plt.ylabel('value')
plt.title('sin, cos Grapeh') #그래프 이름
plt.grid() #그리드 설정
plt.show()
import matplotlib.pyplot as plt #막대 그래프
import numpy as np
data=[10,20,30,55]
x=[0,1,2,3]
plt.bar(x,data,width=0.3)
plt.show()
가로형 막대 랜덤 으로 생기기
1.
import matplotlib.pyplot as plt #막대 그래프
import numpy as np
y_data = []
x_data = []
for i in range(6):
x_data.append(i)
y_data.append(np.random.rand()*20)
plt.bar(x_data, y_data,width=0.5)
plt.show()
2.
import matplotlib.pyplot as plt #막대 그래프
import numpy as np
a = np.random.random(4)
data = np.random.random(4)
plt.bar(a,data,width=0.1)
가로형 막대 그리기
import matplotlib.pyplot as plt #막대 그래프
import numpy as np
data=[10,20,30,5]
x=[1,2,3,4]
plt.barh(x,data,height=0.3)
plt.show()
원형 그래프 그리기
import matplotlib.pyplot as plt #막대 그래프
import numpy as np
data=[10,20,30,5]
plt.pie(data)
plt.show()
from slackclient import SlackClient
import requests as rq
from bs4 import BeautifulSoup
import time
slack_token = 'xoxb-460297928240-2145122313062-cafL1R4QG7nFNRn4QMIrJeiR' #발급 받은 토큰
sc = SlackClient(slack_token)
#메세지 전달
def notification(message):
sc.api_call(
"chat.postMessage",
channel="#test", #{#채널}의 형태로 채널 지정
text=message
)
selected_id = driver.find_element_by_id('nav-trigger') #id로 요소 선택
print(selected_id)
print(selected_id.tag_name) #태그명
print(selected_id.text) #태그에 속한 문자
selected_p = driver.find_element_by_tag_name('p') #id로 요소 선택
print(selected_p)
print(selected_p.tag_name) #태그명
print(selected_p.text) #태그에 속한 문자
selected_tags_p = driver.find_elements_by_tag_name('p') #id로 요소 선택
print(selected_tags_p)