Python Programming
Submitted to: Submitted by:
Dr. Amit Asthana Sushant Ohlyan
Assistant Professor 211302054
F.E.A.T B.Tech CSE Gen 3rd Sem
Content
Python
Key Features
Various modules(Libraries)
Matplotlib
Plotting of various graphs using matplotlib
Types of graphs
Line chart
Bar Plot
Scatter Plot
Histogram
What is Python?
Python is a very popular general-purpose interpreted, interactive, object-
oriented, and high-level programming language.
Python can be used on a server to create web applications.
It was created by Guido van Rossum during 1985- 1990.
Python supports multiple programming paradigms, including Procedural,
Object Oriented and Functional programming language.
Key Features of Python
1. Easy to Code
2. Easy to Read
3. Free and Open-Source
4. Interpreted
5. Robust Standard Library
6. Object-Oriented and Procedure-Oriented
7. Extensible
8. Portable
Some Python Libraries
NumPy
Pandas
Random
Matplotlib
OpenCV
Pillow
sqlite3
Matplotlib
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 was introduced by John Hunter in the year 2002.
One of the greatest benefits of visualization is that it allows us visual access to huge
amounts of data in easily digestible visuals.
Types of graph in Python
Line Plot.
Bar Plot.
Scatter Plot.
Pie Plot.
Area Plot.
Histogram Plot.
Line Plot
Line plots are drawn by joining straight lines connecting data points where the x-axis
and y-axis values intersect. Line plots are the simplest form of representing data.
In Matplotlib, the plot() function is used for plotting .
Bar Plot
The bar plots are vertical/horizontal rectangular graphs that show data comparison
where you can gauge the changes over a period represented in another axis (mostly the
X-axis).
Each bar can store the value of one or multiple data divided in a ratio.
The longer a bar becomes, the greater the value it holds.
In Matplotlib, we use the bar() or barh() function to represent it.
Scatter Plot
We can implement the scatter (previously called XY) plots while comparing various
data variables to determine the connection between dependent and independent
variables.
The data gets expressed as a collection of points clustered together meaningfully.
Here each value has one variable (x) determining the relationship with the other (Y).
Histogram
We can use a histogram plot when the data remains distributed, whereas we can use a
bar graph to compare two entities.
Both histogram and bar plot look alike but are used in different scenarios.
In Matplotlib, the hist() function represents this.