Ticker

6/recent/ticker-posts

Seaborn library in Python for data science:

 Seaborn library in Python for data science:

Seaborn is a data visualization library built over matplotlib. It works very well with pandas library and data frames. It produces very attractive and informative graphs.

Installing and getting started:

For installing go to your command prompt and type pip install seaborn.

For getting started type import seaborn as sns.

Importing seaborn and loading default iris dataset:

 

Importing default iris dataset

Various plots in seaborn:

1) Lineplot:

Lineplot is used to draw the relationship between x and y variable. Datas passed should be numeric.

 

Lineplot in seaborn

2) Scatterplot:

It is used to find the relation between categorical and continuous data. It requires x and y axis. Hue is used to color the dots based on the categorical column.

 

Scatterplot in seaborn

3) Countplot:

It is used to plot the frequency of categorical values. Here in iris data set species is the categorical column and its frequency is plotted using countplot.

 

Countplot in seaborn

4) Kernel Density Estimate(KDE):

KDE is used to plot continuous variables. Here in iris data set sepal_length, sepal_width, petal_length, petal_width can be plotted using KDE.

 
KDE in seaborn


5) Box plot:

Box plot shows the quartiles of the data set. It is used to detect the outliers. Box plot shows the following things.

i. Minimum

ii. First quartile or 25%

iii. Second quartile or median or 50%

iv. Third quartile or 75%

v. Maximum

 

Boxplot in seaborn

6) Violin plot:

Violin plot is very similar to box plot. It is the combination of box plot and Kernel density function. Box plot shows the actual percentiles and violin shows the peaks of the data. 

 

Violin plot in seaborn

7) Joint plot:

Joint plot shows the univariate and bivariate plots together. There are three plots. Middle one shows the joint distribution and the other areas shows the individual distribution.

Joint plot


 8) Pair plot:

Pair plot is having multiple scatter plots in a single plot. It is used to have an overall view of the data.

 

Pair plot in seaborn

9) Heatmap:

Heatmap is used to visualize the confusion matrices and correlation. 

 

Heatmap in seaborn


Post a Comment

0 Comments