You are on page 1of 1

In 

[ ]: joint_grid = sns.jointplot(x='total_bill', y='tip', data=df)

joint_grid.set_axis_labels(xlabel='Total Bill', ylabel='Tip')

joint_grid.fig.suptitle(t='Joint Plot of Total Bill and Tip', fontsize=10, y=1.03)

Hexbins
Group points on a scatter plit into larger points.
In the same way that a histogram can bin a variable to create a bar
hexbin can bin variables to create hexagons

In [ ]: hexbin = sns.jointplot(x="total_bill", y='tip', data=df, kind='hex')

hexbin.set_axis_labels(xlabel='Total Bill', ylabel='Tip')

hexbin.fig.suptitle(t='Hexbin Joint Plot of Total Bill and Tip', fontsize=10, y=1.03)

2D Density Plots
similar to sns.kdeplot
Create a density plot across a bivariate (2 variables)
Can show just the bivariate
or show the invividual univariates

In [ ]: # Just the bivariate

kde, ax1 = plt.subplots()

ax1 = sns.kdeplot(data=df['total_bill'], data2=df['tip'], shade=True) # toggle shade True/False

ax1.set_title('Kernek Density Plot of Total Bill & Tip')

ax1.set_xlabel("Total Bill")

ax1.set_ylabel('Tip')

plt.show()

In [ ]: # Include the univariates

kde_joint = sns.jointplot(x='total_bill', y='tip', data=df, kind='kde')

Bar Plots
Default is to calculate the mean

Use the estimator parameter to pass in any function

In [ ]: bar, ax1 = plt.subplots()

ax1 = sns.barplot(x='time', y='total_bill', data=df)

ax1.set_title('Bar plot of average total bill for time of day')

ax1.set_xlabel('Time of day')

ax1.set_ylabel('Average total bill')

plt.show()

Box Plots
Use to show multiple statistics

e.g. quartiles, max, min, outliers etc

You might also like