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.

672 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 [4]:
sns.jointplot(x='math score',y='reading score',data=df)
Out[4]:
<seaborn.axisgrid.JointGrid at 0x23f9ed8dd08>
In [5]:
sns.jointplot(x='math score',y='reading score',data=df,kind='hex')
Out[5]:
<seaborn.axisgrid.JointGrid at 0x23fa1027308>
In [6]:
sns.jointplot(x='math score',y='reading score',data=df,kind='kde')
Out[6]:
<seaborn.axisgrid.JointGrid at 0x23fa11d4108>

pairplot

In [7]:
sns.pairplot(df)
Out[7]:
<seaborn.axisgrid.PairGrid at 0x23fa12eb608>
In [8]:
sns.pairplot(df,hue='gender',palette='viridis')
Out[8]:
<seaborn.axisgrid.PairGrid at 0x23fa18c8908>
In [9]:
sns.pairplot(df,hue='gender',palette='viridis',corner=True)
Out[9]:
<seaborn.axisgrid.PairGrid at 0x23fa1e07948>
In [10]:
sns.pairplot(df,hue='gender',palette='viridis',diag_kind='hist')
Out[10]:
<seaborn.axisgrid.PairGrid at 0x23fa190ef88>
</html>