Data Visualization with Seaborn
What is Seaborn??
Seaborn is a Python visualization library based on matplotlib. It provides a high-level interface for drawing attractive statistical graphics.
How to install Seaborn??
If you have Python and PIP already installed on a system, install it using this command:
C:\Users\Your Name>pip install seaborn
Types of Plots in Seaborn:
1- DISTRIBUTION PLOTS:
Distribution plots are also known as Distplot, it takes as input an array and plots a curve corresponding to the distribution of points in the array.A distplot plots a univariate distribution of observations.
The distplot() function combines the matplotlib hist function with the seaborn kdeplot() and rugplot() functions.
Let’s have a look at the following Examples:
EXAMPLE- 1:
EXAMPLE- 2:
There are 3 types of distribution plots namely:
- joinplot
- pairplot
- rugplot
Besides providing different kinds of visualization plots, seaborn also contains some built-in datasets. We will be using the tips dataset in this article. The “tips” dataset contains information about people who probably had food at a restaurant and whether or not they left a tip, their age, gender and so on. Lets have a look at it.
1- Joint Plot:
It is used to draw a plot of two variables with bivariate and univariate graphs. It basically combines two different plots.
Syntax:
jointplot(x, y[, data, kind, stat_func, ...])
EXAMPLE:
2- Pair plot:
It represents pairwise relation across the entire dataframe and supports an additional argument called hue for categorical separation.
Syntax:
pairplot(data[, hue, hue_order, palette, …])
Example:
3- RugPlot:
It plots datapoints in an array as sticks on an axis.Just like a distplot it takes a single column. Instead of drawing a histogram it creates dashes all across the plot.
Syntax:
rugplot(a[, height, axis, ax])
EXAMPLE:
2- MATRIX PLOTS:
Matrix plots can be understood by plotting the Heat Maps.
Let’s have a look on to the following Example to understand it better:
3- CATEGORICAL PLOTS:
Categorical plots provided by the
seaborn
library can be used to visualize the counts distribution of 2 ore more categorical variables in relation to each other.
Let’s have a look on following types of categorical plots:
1- STRIP PLOT:
2- Swarm Plot:
3- Bar Plot:
4- Count Plot:
5- Violin Plot:
Hence, with the help of seaborn, we can plot various graphs and can make our diagrams more interesting and visualizing.
THANK YOU!!
KEEP LEARNING!!👍