import matplotlib.pyplot as plt
import numpy as np
%matplotlib inline
import seaborn as sns
x = np.linspace(0,14,100)
y1 = np.sin(x)
y2 = 2*np.sin(x+0.5)
y3 = 4*np.sin(x+1.0)
plt.figure(figsize=(10,6)) # 그림의 크기
plt.plot(x, y1)
plt.plot(x, y1, x,y2, x, y3) # 3개의 sin 그래프
sns.set_style("whitegrid")
plt.plot(x, y1, x,y2, x, y3) # 3개의 sin 그래프
sns.set_style("whitegrid")
tips = sns.load_dataset("tips") # 인터넷이 켜져 있어야 함.
tips
tips.head() ## 앞의 데이터 조금만 살펴보기
import pandas as pd
index=titanic_train["Survived"], # Make a crosstab
columns="count") # Name the count column
my_tab = pd.crosstab(index=tips["time"], # Make a crosstab
columns="count") # Name the count column
my_tab # 동시에 여러개 띄우기
plt.figure(figsize=(8,6))
sns.boxplot(x="day", y="total_bill", data=tips)
plt.show()
plt.figure(figsize=(8,6)) # 사이즈
_____ # 빈칸을 채워보자.
plt.show()
plt.figure(figsize=(8,6))
sns.boxplot(x="day", y="total_bill", hue="smoker", data=tips, palette="Set3")
plt.show()
sns.set_style("darkgrid")
sns.lmplot(x="total_bill", y="tip", data=tips, size=7)
plt.show()
sns.lmplot(x="total_bill", y="tip", hue="smoker", data=tips, palette="Set1", size=7)
plt.show()
연도별 월 승객 ...
fg = sns.load_dataset("flights")
fg.head(5)
fg
type(fg)
fgp = fg.pivot("month", "year", "passengers")
fgp
plt.figure(figsize=(10,8))
sns.heatmap(fgp, annot=True, fmt="d")
plt.show()
sns.set(style="ticks")
iris = sns.load_dataset("iris")
iris
sns.pairplot(iris)
sns.pairplot(iris, hue="species")
plt.show()