Introduction To Data Visualization With Seaborn Chapter3
Introduction To Data Visualization With Seaborn Chapter3
Introduction To Data Visualization With Seaborn Chapter3
plots
I N T R O D U C T I O N TO D ATA V I S U A L I Z AT I O N W I T H S E A B O R N
Erin Case
Data Scientist
Categorical plots
Examples: count plots, bar plots
sns.countplot(x="how_masculine",
data=masculinity_data)
plt.show()
sns.catplot(x="how_masculine",
data=masculinity_data,
kind="count")
plt.show()
sns.catplot(x="how_masculine",
data=masculinity_data,
kind="count",
order=category_order)
plt.show()
sns.catplot(x="day",
y="total_bill",
data=tips,
kind="bar")
plt.show()
sns.catplot(x="day",
y="total_bill",
data=tips,
kind="bar",
ci=None)
plt.show()
sns.catplot(x="total_bill",
y="day",
data=tips,
kind="bar")
plt.show()
Erin Case
Data Scientist
What is a box plot?
Shows the distribution of quantitative data
g = sns.catplot(x="time",
y="total_bill",
data=tips,
kind="box")
plt.show()
g = sns.catplot(x="time",
y="total_bill",
data=tips,
kind="box",
order=["Dinner",
"Lunch"])
plt.show()
g = sns.catplot(x="time",
y="total_bill",
data=tips,
kind="box",
sym="")
plt.show()
g = sns.catplot(x="time",
y="total_bill",
data=tips,
kind="box",
whis=[0, 100])
plt.show()
Erin Case
Data Scientist
What are point plots?
Points show mean of quantitative variable
Differences:
sns.catplot(x="age",
y="masculinity_important",
data=masculinity_data,
hue="feel_masculine",
kind="point")
plt.show()
sns.catplot(x="age",
y="masculinity_important",
data=masculinity_data,
hue="feel_masculine",
kind="point",
join=False)
plt.show()
sns.catplot(x="smoker",
y="total_bill",
data=tips,
kind="point")
plt.show()
sns.catplot(x="smoker",
y="total_bill",
data=tips,
kind="point",
estimator=median)
plt.show()
sns.catplot(x="smoker",
y="total_bill",
data=tips,
kind="point",
capsize=0.2)
plt.show()
sns.catplot(x="smoker",
y="total_bill",
data=tips,
kind="point",
ci=None)
plt.show()