0% found this document useful (0 votes)
17 views16 pages

Session 5

Uploaded by

mostafa
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views16 pages

Session 5

Uploaded by

mostafa
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 16

Machine Learning Diploma

Session5: Matplotlib & Seaborn


Agenda
➔ Matplotlib
➔ Seaborn
➔ Practice Project

2
1. Matplotlib

3
Matplotlib:
➔ Matplotlib can be used for creating plots and charts. The libraryis
generally used as follows:
○ Call a plotting function with some data (e.g. .plot()).
○ Call many functions to setup the properties of the plot (e.g. labels
and colors).
○ Make the plot visible (e.g. .show()).

4
Matplotlib: Line plot
➔ To create a simple line plot from one dimensional data.

5
Matplotlib: Scatter plot
➔ To create a scatter plot from two dimensional data.

6
2. seaborn

3
Seaborn vs Matplotlib?
➔ Matplotlib: It is a Python library used for plotting graphs with the
help of other libraries like Numpy and Pandas. It is a powerful tool
for visualizing data in Python. It is used for creating statical
interferences and plotting 2D graphs of arrays. It was first
introduced by John D. Hunter in 2002. It uses Pyplot for providing
MATLAB like interface free and open-source. It is capable of dealing
with various operating systems and their graphical backends.

8.
Seaborn vs Matplotlib?
➔ Seaborn: It is also a Python library used for plotting graphs with the
help of Matplotlib, Pandas, and Numpy. It is built on the roof of
Matplotlib and is considered as a superset of the Matplotlib library.
It helps in visualizing univariate and bivariate data. It uses beautiful
themes for decorating Matplotlib graphics. It acts as an important
tool in picturing Linear Regression Models. It serves in making
graphs of statical Time-Series data. It eliminates the overlapping of

9 graphs and also aids in their beautification.


Seaborn vs Matplotlib?
Features Matplotlib Seaborn
Seaborn contains a number of
It is utilized for making basic
patterns and plots for data
graphs. Datasets are visualised
visualization. It uses fascinating
Functionality with the help of bargraphs,
themes. It helps in compiling
histograms, piecharts, scatter
whole data into a single plot. It
plots, lines and so on.
also provides distribution of data.
It uses comparatively complex It uses comparatively simple
and lengthy syntax. Example: syntax which is easier to learn
Syntax Syntax for bargraph- and understand. Example: Syntax
matplotlib.pyplot.bar(x_axis, for bargraph-
y_axis). seaborn.barplot(x_axis, y_axis).

3
Seaborn vs Matplotlib?
We can open and use multiple
figures simultaneously. However,
Seaborn sets time for the
they are closed distinctly. Syntax
creation of each figure. However,
Dealing Multiple Figures to close one figure at a time:
it may lead to (OOM) out of
matplotlib.pyplot.close(). Syntax
memory issues
to close all the figures:
matplotlib.pyplot.close(“all”)
Matplotlib is well connected with
Numpy and Pandas and acts as a Seaborn is more comfortable in
graphics package for data handling Pandas data frames. It
Visualization visualization in python. Pyplot uses basic sets of methods to
provides similar features and provide beautiful graphics in
syntax as in MATLAB. Therefore, python.
MATLAB users can easily study it.
Seaborn vs Matplotlib?
Seaborn avoids overlapping of
Matplotlib is a highly customized
Pliability plots with the help of its default
and robust
themes
Matplotlib works efficiently with Seaborn is much more functional
data frames and arrays. It treats and organized than Matplotlib
figures and axes as objects. It and treats the whole dataset as a
Data Frames and Arrays contains various stateful APIs for single unit. Seaborn is not so
plotting. Therefore plot() like stateful and therefore,
methods can work without parameters are required while
parameters. calling methods like plot()
Seaborn is the extended version
Matplotlib plots various graphs of Matplotlib which uses
Use Cases
using Pandas and Numpy Matplotlib along with Numpy and
Pandas for plotting graphs
4. Practical Projects

13
Project: Titanic Dataset
➔ Load the dataset. And investigate its content:
○ What is the dimensions of this data?
○ How many features?
○ What is the output data type? Qualitative or quantitative?
○ Does it have nulls?
○ Does it have duplicate values?
○ Does it have outliers?
○ Try to make a full EDA with visualizations to investigate the
data.

14
Any Questions?

15
THANK YOU!

You might also like