728x90
가로형 막대그래프는 세로로 되어있는 막대그래프를 가로로 눕힌 형태이다. 가로로 표현했을 때 시각적으로 더 뛰어난 경우에 사용하면 좋다.
import matplotlib.pyplot as plt
import seaborn as sns
if __name__ == '__main__':
sns.set_style(style="whitegrid")
tips = sns.load_dataset("tips")
tips = tips.groupby('day').mean()['total_bill'].reset_index()
print(tips)
bar = sns.barplot(y="day", x="total_bill", data=tips)
plt.show()
결과 값
day total_bill
0 Thur 17.682742
1 Fri 17.151579
2 Sat 20.441379
3 Sun 21.410000
728x90
'Data Science > Data Visualization' 카테고리의 다른 글
[02. Line Chart] 001. Multi-Line Chart (0) | 2021.08.21 |
---|---|
[02. Line Chart] 001. Line Chart (0) | 2021.08.21 |
[01. Bar Chart] 004. Percentage Stacked Bar Chart (0) | 2021.08.21 |
[01. Bar Chart] 003. Stacked Bar Chart (0) | 2021.08.21 |
[01. Bar Chart] 001. Bar Chart (0) | 2021.08.21 |