%matplotlib notebook
import matplotlib.pyplot as plt
import seaborn as sns
tips = sns.load_dataset("tips")
ax = plt.subplots()
# ax = sns.distplot(tips['total_bill'])
# ax = sns.distplot(tips['total_bill'], kde=False)
# ax = sns.distplot(tips['total_bill'], hist=False)
ax = sns.distplot(tips['total_bill'], rug=True)
ax.set_title('Total Bill Histogram with Density Plot')
ax = plt.subplots()
ax = sns.countplot('day', data=tips)
ax.set_title('Count of days')
ax.set_xlabel('Day of the Week')
ax.set_ylabel('Frequency')
ax = plt.subplots()
ax = sns.regplot(x='total_bill', y='tip', data=tips)
# ax = sns.regplot(x='total_bill', y='tip', data=tips, fit_reg=False) # 회귀선 제거
ax.set_title('Scatterplot of Total Bill and Tip')
ax.set_xlabel('Total Bill')
ax.set_ylabel('Tip')
joint = sns.jointplot(x='total_bill', y='tip', data=tips)
# joint = sns.jointplot(x='total_bill', y='tip', data=tips, kind="hex")
joint.set_axis_labels(xlabel='Total Bill', ylabel='Tip')
joint.fig.suptitle('Joint Plot of Total Bill and Tip', fontsize=10, y=1.03)
ax = plt.subplots()
ax = sns.kdeplot(data=tips['total_bill'],
data2=tips['tip'],
shade=True)
ax.set_title('Kernel Density Plot of Total Bill and Tip')
ax.set_xlabel('Total Bill')
ax.set_ylabel('Tip')
ax = plt.subplots()
ax = sns.barplot(x='time', y='total_bill', data=tips)
ax.set_title('Bar plot of average total bill for time of day')
ax.set_xlabel('Time of day')
ax.set_ylabel('Average total bill')
'Development > Python' 카테고리의 다른 글
[pandas] DO IT 데이터분석을 위한 판다스 입문 (데이터 연결) (0) | 2019.10.04 |
---|---|
[pandas] DO IT 데이터분석을 위한 판다스 입문 (Chart Documentation) (0) | 2019.10.04 |
[pandas] DO IT 데이터분석을 위한 판다스 입문 (그래프2) (0) | 2019.10.04 |
[pandas] DO IT 데이터분석을 위한 판다스 입문 (그래프) (0) | 2019.10.03 |
[pandas] DO IT 데이터분석을 위한 판다스 입문 (데이터 저장) (0) | 2019.10.02 |