Regresión con otros tipos de gráficos usando joinplot() y pairplot() —#
0:00 min | Última modificación: Octubre 13, 2021 | [YouTube]
[1]:
import matplotlib.pyplot as plt
import seaborn as sns
[2]:
tips = sns.load_dataset("tips")
tips.head()
[2]:
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 |
[3]:
#
# Uso de joinplot()
#
sns.jointplot(
x="total_bill",
y="tip",
data=tips,
kind="reg",
)
plt.show()
[4]:
#
# Uso de pairplot()
#
sns.pairplot(
tips,
x_vars=["total_bill", "size"],
y_vars=["tip"],
height=5,
aspect=0.8,
kind="reg",
)
plt.show()
[5]:
sns.pairplot(
tips,
x_vars=["total_bill", "size"],
y_vars=["tip"],
hue="smoker",
height=5,
aspect=0.8,
kind="reg",
)
plt.show()