Sunday 6 September 2020

seaborn 7 barplot

 import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
from scipy import signal
sns.set(style="darkgrid")

tips = sns.load_dataset("tips")
tips.head()

  total_bill tip sex smoker day time size
0 16.99 1.01 Female No Sun Dinner 2
1 10.34 1.66 Male No Sun Dinner 3
2 21.01 3.50 Male No Sun Dinner 3
3 23.68 3.31 Male No Sun Dinner 2
4 24.59 3.61 Female No Sun Dinner 4

sns.barplot(x="day", y="total_bill", data=tips)

sns.barplot(x="day", y="total_bill", hue="sex", data=tips)

sns.barplot(x="time", y="tip", data=tips,
                 order=["Dinner", "Lunch"])

from numpy import median
sns.barplot(x="day", y="tip", data=tips, estimator=median)

sns.barplot("size", y="total_bill", data=tips,
                 palette="Blues_d")

sns.catplot(x="sex", y="total_bill",
                hue="smoker", col="time",
                data=tips, kind="bar",
                height=4, aspect=.7);

No comments:

Post a Comment