<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 Distribution Plots
Let's discuss some plots that allow us to visualize the distribution of a data set. These plots are
Step1:  Data
Seaborn comes with built-in data sets!
Step2:  distplot
The distplot shows the distribution of a univariate set of observations.
Step3:  To remove the kde layer and just have the histogram use
Step4:  jointplot
jointplot() allows you to basically match up two distplots for bivariate data. With your choice of what kind parameter to compare with
Step5:  pairplot
pairplot will plot pairwise relationships across an entire dataframe (for the numerical columns) and supports a color hue argument (for categorical columns).
Step6:  rugplot
rugplots are actually a very simple concept, they just draw a dash mark for every point on a univariate distribution. They are the building block of a KDE plot
Step7:  kdeplot
kdeplots are Kernel Density Estimation plots. These KDE plots replace every single observation with a Gaussian (Normal) distribution centered around that value. For example
Step8:  So with our tips dataset
<ASSISTANT_TASK:>
Python Code:
import seaborn as sns
%matplotlib inline
Explanation: Distribution Plots
Let's discuss some plots that allow us to visualize the distribution of a data set. These plots are:
distplot
jointplot
pairplot
rugplot
kdeplot
Imports
End of explanation
tips = sns.load_dataset('tips')
tips.head()
Explanation: Data
Seaborn comes with built-in data sets!
End of explanation
sns.distplot(tips['total_bill'])
# Safe to ignore warnings
Explanation: distplot
The distplot shows the distribution of a univariate set of observations.
End of explanation
sns.distplot(tips['total_bill'],kde=False,bins=30)
Explanation: To remove the kde layer and just have the histogram use:
End of explanation
sns.jointplot(x='total_bill',y='tip',data=tips,kind='scatter')
sns.jointplot(x='total_bill',y='tip',data=tips,kind='hex')
sns.jointplot(x='total_bill',y='tip',data=tips,kind='reg')
Explanation: jointplot
jointplot() allows you to basically match up two distplots for bivariate data. With your choice of what kind parameter to compare with: 
* “scatter” 
* “reg” 
* “resid” 
* “kde” 
* “hex”
End of explanation
sns.pairplot(tips)
sns.pairplot(tips,hue='sex',palette='coolwarm')
Explanation: pairplot
pairplot will plot pairwise relationships across an entire dataframe (for the numerical columns) and supports a color hue argument (for categorical columns).
End of explanation
sns.rugplot(tips['total_bill'])
Explanation: rugplot
rugplots are actually a very simple concept, they just draw a dash mark for every point on a univariate distribution. They are the building block of a KDE plot:
End of explanation
# Don't worry about understanding this code!
# It's just for the diagram below
import numpy as np
import matplotlib.pyplot as plt
from scipy import stats
#Create dataset
dataset = np.random.randn(25)
# Create another rugplot
sns.rugplot(dataset);
# Set up the x-axis for the plot
x_min = dataset.min() - 2
x_max = dataset.max() + 2
# 100 equally spaced points from x_min to x_max
x_axis = np.linspace(x_min,x_max,100)
# Set up the bandwidth, for info on this:
url = 'http://en.wikipedia.org/wiki/Kernel_density_estimation#Practical_estimation_of_the_bandwidth'
bandwidth = ((4*dataset.std()**5)/(3*len(dataset)))**.2
# Create an empty kernel list
kernel_list = []
# Plot each basis function
for data_point in dataset:
    
    # Create a kernel for each point and append to list
    kernel = stats.norm(data_point,bandwidth).pdf(x_axis)
    kernel_list.append(kernel)
    
    #Scale for plotting
    kernel = kernel / kernel.max()
    kernel = kernel * .4
    plt.plot(x_axis,kernel,color = 'grey',alpha=0.5)
plt.ylim(0,1)
# To get the kde plot we can sum these basis functions.
# Plot the sum of the basis function
sum_of_kde = np.sum(kernel_list,axis=0)
# Plot figure
fig = plt.plot(x_axis,sum_of_kde,color='indianred')
# Add the initial rugplot
sns.rugplot(dataset,c = 'indianred')
# Get rid of y-tick marks
plt.yticks([])
# Set title
plt.suptitle("Sum of the Basis Functions")
Explanation: kdeplot
kdeplots are Kernel Density Estimation plots. These KDE plots replace every single observation with a Gaussian (Normal) distribution centered around that value. For example:
End of explanation
sns.kdeplot(tips['total_bill'])
sns.rugplot(tips['total_bill'])
sns.kdeplot(tips['tip'])
sns.rugplot(tips['tip'])
Explanation: So with our tips dataset:
End of explanation
<END_TASK>