터미널을 통해 jupyter notebook 실행하는 방법?
-> conda activate ds_study : ds_study 환경설정
-> cd Documents/ : 문서로 폴더 이동
-> cd ds_study : ds_study 폴더로 이동
-> jupyter notebook : 주피터 노트북 실행
삼각함수 그리기
import numpy as np
t = np.arange(0, 12, 0.01)
y = np.sin(t)
plt.figure(figsize=(10,6))
plt.plot(t, np.sin(t))
plt.plot(t, np.cos(t))
plt.show()
def drawGraph():
plt.figure(figsize=(10,6))
plt.plot(t, np.sin(t), label="sin")
plt.plot(t, np.cos(t), label="cos")
plt.grid(True) #배경 격자 표시
plt.legend(loc="lower left")
# upper, lower, left, right 범례 위치 설정 가능
plt.title("Example of sinewave")
plt.xlabel("time")
plt.ylabel("Amplitude")
plt.show()
drawGraph()
t = np.arange(0, 5, 0.5)
t
array([0. , 0.5, 1. , 1.5, 2. , 2.5, 3. , 3.5, 4. , 4.5])
plt.figure(figsize=(10,6))
plt.plot(t, t, "r--") #red---
plt.plot(t, t ** 2, "bs") #blue
plt.plot(t, t ** 3, "g^") #grin
plt.show()
#t = [0,1,2,3,4,5,6]
t = list(range(0,7))
y = [1,4,5,8,9,5,3]
def drawGraph():
plt.figure(figsize=(10,6))
plt.plot(
t,
y,
color = "skyblue",
linestyle = "dashed", #점선
marker = ">",
markerfacecolor="blue",
markersize="10",)
plt.xlim([-0.5,6.5])
plt.ylim([0.5, 9.5])
plt.show()
drawGraph()
t = np.array(range(0,10))
y = np.array([9, 8, 7, 9, 8, 3, 2, 4, 3, 4])
def drawGraph():
plt.figure(figsize=(20,6))
plt.scatter(t, y)
plt.show()
drawGraph()
colormap = t
def drawGraph():
plt.figure(figsize=(20, 6))
plt.scatter(t, y, s=150 , c=colormap, marker="<")
plt.colorbar()
plt.show()
drawGraph()