You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

539 KiB

<html> <head> </head>

___

Copyright by Pierian Data Inc. For more information, visit us at www.pieriandata.com

Comparison Plots with pairplot() and jointplot()

Imports

In [1]:
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns

The Data

In [2]:
df = pd.read_csv("StudentsPerformance.csv")
In [3]:
df.head()
Out[3]:
gender race/ethnicity parental level of education lunch test preparation course math score reading score writing score
0 female group B bachelor's degree standard none 72 72 74
1 female group C some college standard completed 69 90 88
2 female group B master's degree standard none 90 95 93
3 male group A associate's degree free/reduced none 47 57 44
4 male group C some college standard none 76 78 75

jointplot

In [6]:
sns.jointplot(x='math score',y='reading score',data=df)
Out[6]:
<seaborn.axisgrid.JointGrid at 0x1ec7d365b08>
In [11]:
sns.jointplot(x='math score',y='reading score',data=df,kind='hex')
Out[11]:
<seaborn.axisgrid.JointGrid at 0x1ec7dde1188>
In [12]:
sns.jointplot(x='math score',y='reading score',data=df,kind='kde')
Out[12]:
<seaborn.axisgrid.JointGrid at 0x1ec7ef41b88>

pairplot

In [13]:
sns.pairplot(df)
Out[13]:
<seaborn.axisgrid.PairGrid at 0x1ec7f071348>
In [17]:
sns.pairplot(df,hue='gender',palette='viridis')
Out[17]:
<seaborn.axisgrid.PairGrid at 0x1ec01c711c8>
In [18]:
sns.pairplot(df,hue='gender',palette='viridis',corner=True)
Out[18]:
<seaborn.axisgrid.PairGrid at 0x1ec7fbd0608>
In [20]:
sns.pairplot(df,hue='gender',palette='viridis',diag_kind='hist')
Out[20]:
<seaborn.axisgrid.PairGrid at 0x1ec02dccf88>
</html>