sns1 - distribution

import seaborn as sns
tips = sns.load_dataset('tips')
# tips.head()
#distplot ->histogram
sns.distplot(tips['total_bill'],kde=False,bins=10) #kde=false will remove line
#jointplot
sns.jointplot(x='total_bill',y='tip',data=tips,kind='kde')# this give that upar niche bar, under point
#kind ->'hex','reg','kde'
sns.pairplot(tips,hue='sex',palette='coolwarm')#sab se important

sns.rugplot(tips) #similar to histogram, the lines where are denser dash mark for everyline
sns.kdeplot(tips['total_bill'])

sns2 - Categorical

import seaborn as sns
import numpy as np
tips = sns.load_dataset('tips')
sns.barplot(x='sex',y='total_bill',data =tips,estimator=np.std) #estimator-> mai->function
sns.countplot(x='sex',data=tips) #Like pandas .count() function
sns.boxplot(x='day',y='total_bill',data =tips,hue='smoker')
sns.violinplot(x='day',y='total_bill',data =tips,hue='smoker',split = True)
sns.stripplot(x='day',y='total_bill',data =tips,hue='smoker',jitter=True) #jitter add some noice, so easy to understand
# sns.violinplot(x='day',y='total_bill',data =tips)
sns.swarmplot(x='day',y='total_bill',data =tips) #need computation for it
sns.factorplot(x='day',y='total_bill',data =tips,kind='bar') #give the value kind

sns3 - Matrix Plot

import seaborn as sns
import numpy as np
tips = sns.load_dataset('tips')
flights = sns.load_dataset('flights')
#first i need to convert it to matrix, it can be either done with pivot or we can do it with corr()
# tips.corr()
sns.heatmap(tips.corr(),annot=True)#need a matrix, annot give values
#cmap = "coolwarm"
# flights.head()
fp=flights.pivot_table(index='month',columns='year',values='passengers')
sns.heatmap(fp)
#cmap = 'magma' #linecolor=white #linewidths=3

sns.clustermap(fp) #shows similarity #standard_scale=1 #to get little more information then normal

sns4 - Grid

import seaborn as sns
iris = sns.load_dataset('iris')
iris.head()

sns.pairplot(iris) #very import, it just create automated thing

g = sns.PairGrid(iris) #it's a simeple way to make it make: 4X4 matrix of plot
g.map_diag(sns.distplot)
g.map_upper(plt.scatter)
g.map_lower(sns.kdeplot)

tips = sns.load_dataset('tips')
g = sns.FacetGrid(tips,col='time',row='smoker') #make the things as per required
g.map(sns.distplot,'total_bill')

sns5 - Style and color

import seaborn as sns
tips = sns.load_dataset('tips')

sns.set_style()#white,ticks,darkgrid,whitegrid
sns.countplot(x='sex',data=tips)
sns.despine(left=True,bottom=True)#remove top spine and right spine
#you can use matplot lib knowledge, plt.figure(figsize=(12,3))
#if you are preparing for any other thing like poster
# sns.set_context('poster',font_scale=3)#notebook

sns.lmplot(x='total_bill',y='tip',data=tips,hue='sex')
#pallete='coolworm' you can go to matplotlib/colormap and change you pallete to those you want

sns6: exercise

sns.jointplot(x='fare',y='age',data=titanic)
2.#here using kde = False gives me the value then density
sns.distplot(titanic['fare'],bins=30,kde=False,color='red') #need value, like itne fiar ke kitne log the
sns.boxplot(x='class',y='age',data=titanic)
sns.swarmplot(x='class',y='age',data=titanic)

plt.hist(x='sex',data=titanic)#this also work as countplot
sns.countplot(x='sex',data=titanic) #to print the count of sexes that are in the data

g = sns.FacetGrid(titanic,col='sex')
g.map(plt.hist,'age')