0% found this document useful (0 votes)
8 views10 pages

EXP7

The document outlines an experiment focused on data visualization using the Matplotlib and Seaborn libraries in Python. It details the aims of the experiment, system requirements, theoretical background, and various data visualization techniques implemented, such as scatterplots, boxplots, and histograms. The conclusion highlights the exploration of both libraries, customization of plots, and the effectiveness of different visualization methods.

Uploaded by

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

EXP7

The document outlines an experiment focused on data visualization using the Matplotlib and Seaborn libraries in Python. It details the aims of the experiment, system requirements, theoretical background, and various data visualization techniques implemented, such as scatterplots, boxplots, and histograms. The conclusion highlights the exploration of both libraries, customization of plots, and the effectiveness of different visualization methods.

Uploaded by

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

SIES Graduate School of Technology

Sri Chandrasekarendra Saraswati Vidyapuram


Sector V, Nerul, Navi Mumbai - 400706

Name of the Student:Aayush


Roll No.:122A8002
Class:
Batch: B1

EXPERIMENT NO. 7
Data Visualization: Matplotlib and Seaborn Library.

Aim: 1. Write a program in python to explore the matplotlib and seaborn library.
2. Write a program to plot, subplot functions, change the color, line style of the plot.
3. Write a program to visualize data using scatterplot, boxplot, histogram, line graph,
bar chart, violin plot, and regression plot and to draw appropriate conclusions.

System Requirements: Python.

Theory:
Matplotlib is a comprehensive library for creating static, animated, and interactive
visualizations in Python. Matplotlib is an amazing visualization library in Python for 2D plots
of arrays. Matplotlib is a multi-platform data visualization library built on NumPy arrays and
designed to work with the broader SciPy stack. It can be used in python scripts, shell, web
application, and other graphical user interface toolkit. Matplotlib comes with a wide variety of
plots which helps to understand trends, patterns, and to make correlations. A procedural
interface is provided by the companion pyplot module, which may be imported directly.
Matplotlib.pyplot is a collection of functions. Each pyplot function makes some change to a
figure: e.g., creates a figure, creates a plotting area in a figure, plots some lines in a plotting
area, decorates the plot with labels, etc. While working with matplotlib.pyplot, some states are
stored across function calls so that it keeps track of the things like current figure and plotting
area, and these plotting functions are directed to the current axes. The pyplot module provide
the plot() function which is frequently use to plot a graph. Pyplot have the concept of the
current figure and the current axes. All plotting functions apply to the current axes.
Figure: It is a whole figure which may hold one or more axes (plots). We can think of a Figure
as a canvas that holds plots.
Axes: A Figure can contain several Axes. It consists of two or three (in the case of 3D) Axis
objects. Each Axes is comprised of a title, an x-label, and a y-label.
Axis: Axises are the number of line like objects and responsible for generating the graph limits.

Seaborn is a library for making statistical graphics in Python. It builds on top of matplotlib and
integrates closely with pandas data structures. Seaborn helps to explore and understand the
data. Its plotting functions operate on data frames and arrays containing whole datasets and
internally perform the necessary semantic mapping and statistical aggregation to produce
informative plots. Seaborn offers the following functionalities:
1. Dataset oriented API to determine the relationship between variables.
2. Automatic estimation and plotting of linear regression plots.
3. It supports high-level abstractions for multi-plot grids.
4. Visualizing univariate and bivariate distribution.

Department of Artificial Intelligence and Data Science CSL601: Data Analytics and Visualization Lab
SIES Graduate School of Technology
Sri Chandrasekarendra Saraswati Vidyapuram
Sector V, Nerul, Navi Mumbai - 400706
Seaborn supports several different dataset formats, and most functions accept data represented
with objects from the pandas or numpy libraries as well as built-in Python types like lists and
dictionaries. Most plotting functions in seaborn are oriented towards vectors of data. When
plotting x against y, each variable should be a vector. Seaborn accepts data sets that have more
than one vector organized in some tabular fashion. There is a fundamental distinction between
“long-form” and “wide-form” data tables, and seaborn will treat each differently. A long-form
data table has the following characteristics: Each variable is a column and Each observation is
a row. For wide-form data, there is a clear association between the dimensions of the table and
the variable in the dataset, seaborn is able to assign those variables roles in the plot. For simple
datasets, it is often more intuitive to think about data the way it might be viewed in a
spreadsheet, where the columns and rows contain levels of different variables.

Code&Output:

Using matplotlib:

Department of Artificial Intelligence and Data Science CSL601: Data Analytics and Visualization Lab
SIES Graduate School of Technology
Sri Chandrasekarendra Saraswati Vidyapuram
Sector V, Nerul, Navi Mumbai - 400706

Department of Artificial Intelligence and Data Science CSL601: Data Analytics and Visualization Lab
SIES Graduate School of Technology
Sri Chandrasekarendra Saraswati Vidyapuram
Sector V, Nerul, Navi Mumbai - 400706

Department of Artificial Intelligence and Data Science CSL601: Data Analytics and Visualization Lab
SIES Graduate School of Technology
Sri Chandrasekarendra Saraswati Vidyapuram
Sector V, Nerul, Navi Mumbai - 400706

Department of Artificial Intelligence and Data Science CSL601: Data Analytics and Visualization Lab
SIES Graduate School of Technology
Sri Chandrasekarendra Saraswati Vidyapuram
Sector V, Nerul, Navi Mumbai - 400706

Using seabornlib:

Department of Artificial Intelligence and Data Science CSL601: Data Analytics and Visualization Lab
SIES Graduate School of Technology
Sri Chandrasekarendra Saraswati Vidyapuram
Sector V, Nerul, Navi Mumbai - 400706

Department of Artificial Intelligence and Data Science CSL601: Data Analytics and Visualization Lab
SIES Graduate School of Technology
Sri Chandrasekarendra Saraswati Vidyapuram
Sector V, Nerul, Navi Mumbai - 400706

Department of Artificial Intelligence and Data Science CSL601: Data Analytics and Visualization Lab
SIES Graduate School of Technology
Sri Chandrasekarendra Saraswati Vidyapuram
Sector V, Nerul, Navi Mumbai - 400706

Conclusion:

In this experiment, we explored various features and functionalities provided by Matplotlib


and Seaborn for data visualization:

1. Exploring Matplotlib and Seaborn: We familiarized ourselves with both libraries,


learning how to create basic plots, customize them, and use their various features.
Department of Artificial Intelligence and Data Science CSL601: Data Analytics and Visualization Lab
SIES Graduate School of Technology
Sri Chandrasekarendra Saraswati Vidyapuram
Sector V, Nerul, Navi Mumbai - 400706
Matplotlib provided us with low-level control over our plots, while Seaborn offered
more sophisticated and aesthetically pleasing visualizations with simpler syntax.
2. Plot Customization: We learned how to modify the appearance of plots, including
adjusting colors, line styles, and adding subplots. This level of customization helps
create more informative and visually appealing plots, which is essential when
presenting data insights.
3. Data Visualization Techniques: We implemented a variety of visualizations,
including:
o Scatterplot: Used to visualize the relationship between two continuous variables.
o Boxplot: Provided insights into the distribution, central tendency, and variability of the
data.
o Histogram: Allowed us to understand the frequency distribution of numerical data.
o Line Graph: Helpful for visualizing trends over time.
o Bar Chart: Used to compare categorical data.
o Violin Plot: Gave a combined view of the distribution and density of the data, making
it easier to understand the shape of the data.
o Regression Plot: Showed the relationship between variables and fitted a regression
line, useful for understanding linear relationships.

Department of Artificial Intelligence and Data Science CSL601: Data Analytics and Visualization Lab

You might also like