이번에는 Seaborn의 다음과 같은 그래프에 대해 알아봅시다.
In [2]:import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
In [3]:titanic = sns.load_dataset('titanic')
titanic
Out[3]:In [4]:tips = sns.load_dataset('tips')
In [2]:
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
In [3]:
titanic = sns.load_dataset('titanic')
titanic
Out[3]:
In [4]:
tips = sns.load_dataset('tips')
Heatmap
In [5]:uniform_data = np.random.rand(10, 12)
sns.heatmap(uniform_data, annot=True)
plt.show()
In [5]:
uniform_data = np.random.rand(10, 12)
sns.heatmap(uniform_data, annot=True)
plt.show()
Pivot Plot
In [6]:tips.head()
Out[6]:In [7]:pivot = tips.pivot_table(index='day', columns='size', values='tip')
pivot
Out[7]:In [8]:sns.heatmap(pivot, annot=True)
plt.show()
In [6]:
tips.head()
Out[6]:
In [7]:
pivot = tips.pivot_table(index='day', columns='size', values='tip')
pivot
Out[7]:
In [8]:
sns.heatmap(pivot, annot=True)
plt.show()
Correlation 시각화
In [9]:titanic.corr()
Out[9]:In [10]:sns.heatmap(titanic.corr(), annot=True, cmap="YlGnBu")
plt.show()
In [9]:
titanic.corr()
Out[9]:
In [10]:
sns.heatmap(titanic.corr(), annot=True, cmap="YlGnBu")
plt.show()
Pair Plot
In [11]:tips.head()
Out[11]:In [12]:sns.pairplot(tips)
plt.show()
In [13]:sns.pairplot(tips, hue='size')
plt.show()
In [14]:sns.pairplot(tips, hue='size', palette="rainbow")
plt.show()
In [15]:sns.pairplot(tips, hue='size', palette="rainbow", height=5,)
plt.show()
In [11]:
tips.head()
Out[11]:
In [12]:
sns.pairplot(tips)
plt.show()
In [13]:
sns.pairplot(tips, hue='size')
plt.show()
In [14]:
sns.pairplot(tips, hue='size', palette="rainbow")
plt.show()
In [15]:
sns.pairplot(tips, hue='size', palette="rainbow", height=5,)
plt.show()
Violin Plot
In [17]:sns.violinplot(x=tips["total_bill"])
plt.show()
In [18]:sns.violinplot(x="day", y="total_bill", data=tips)
plt.show()
In [19]:sns.violinplot(y="day", x="total_bill", data=tips)
plt.show()
In [20]:sns.violinplot(x="day", y="total_bill", hue="smoker", data=tips, palette="muted")
plt.show()
In [21]:sns.violinplot(x="day", y="total_bill", hue="smoker", data=tips, palette="muted", split=True)
plt.show()
In [17]:
sns.violinplot(x=tips["total_bill"])
plt.show()
In [18]:
sns.violinplot(x="day", y="total_bill", data=tips)
plt.show()
In [19]:
sns.violinplot(y="day", x="total_bill", data=tips)
plt.show()
In [20]:
sns.violinplot(x="day", y="total_bill", hue="smoker", data=tips, palette="muted")
plt.show()
In [21]:
sns.violinplot(x="day", y="total_bill", hue="smoker", data=tips, palette="muted", split=True)
plt.show()
댓글 없음:
댓글 쓰기