Saturday 22 August 2020

Data Science & Machine Learning - 7.2 Seaborn Distribution Plots

Hi friends,

Welcome to this post on visualizing Distribution Plots under Data Science & Machine Learning. In the previous post, we discussed about the installation process of Seaborn library for Data Visualization. In this post, we'll learn about distribution plots supported by Seaborn that allows us to visualize the distribution of a dataset.

Note: All the commands discussed below are run in the Jupyter Notebook environment. See this post on Jupyter Notebook to know about it in detail. 

Seaborn Distribution Plots

So, let's first import the useful libraries. 


I have imported NumPy library as well to generate random data to fill our plots with. Now, let's start with creating various plots using Seaborn.
  1. distplot : It is used to visualize the distribution of a univariate (one variable) data points. In the example below, first we generated a random NumPy array and then plot a distribution plot of the same using the Seaborn's distplot() method:


    What it returns is basically a histogram of data points and the dark blue line is called the KDE (Kernel Density Estimation). We can remove the KDE from our plot by setting the kde parameter to false.

    The y-axis represents the count of the data points in the range represented by x-axis. We can also change the bins parameter to get a detailed/abstract view of the data points. Generally, larger the bins value more detailed the distribution plot and smaller the bins value less detailed the distribution plot.
Share:

Sunday 16 August 2020

Data Science & Machine Learning - 7.1 Seaborn & Its Installation

Hi friends,

Welcome to this post on Data Visualization under Data Science & Machine Learning. In the previous few posts, we discussed about the Matplotlib plotting library in Python for Data Visualization. In the next few posts, we'll learn about Seaborn, another powerful Python visualization library built on top of Matplotlib.

About Seaborn [1]

Seaborn is a powerful Python Data Visualization library for making informative statistical graphics in Python. It is built on top of Matplotlib and include support for NumPy and Pandas data structures and statistical routines from Scipy and Statsmodels.

Some of the features that Seaborn offers are

Here are some of the plots supported by the Seaborn library:

screenshots       screenshots

screenshots       screenshots

Image source: Seaborn

Seaborn Installation

Just like the installation of other Python Data Science libraries such as NumPy/Pandas/Matplotlib, it is recommended to use the Anaconda distribution of Python in order to install Seaborn as well. You can see the installation of Anaconda distribution of Python here. Once you have that installed, you can install Seaborn by running the following command in the command prompt:

conda install seaborn

You can still install Seaborn even if you don't have the recommended Anaconda distribution of Python (not recommended) using the following command:

pip install seaborn

You can see the list of various plots supported by Seaborn from this linkNow that we have installed Seaborn successfully on our systems, we will start using the Seaborn library starting with various plots for visualizing the distribution of a dataset from the next post.
Share:

Contact Me

Name

Email *

Message *

Popular Posts