Introduction To Matplotlib
Introduction To Matplotlib
PYTHON PROGRAMMING
24CAH-606
2
Matplotlib
• Matplotlib Pyplot
3
Matplotlib
• Plotting Without Line
4
Matplotlib
5
Matplotlib
• Default X-Points :If we do not specify the points in the x-axis, they will get the
default values 0, 1, 2, 3, (etc. depending on the length of the y-points).
6
Matplotlib
• Line Properties: There are the following line properties:
• linestyle
• Color
• linewidth
• marker
• ms(marker size)
• mfc(marker color)
• title
• xlabel
• ylabel
• grid 7
Matplotlib
• Linestyle
8
Matplotlib
• Matplotlib Labels and Title
9
Matplotlib
• Add Grid Lines to a Plot
10
Matplotlib
• Display Multiple Plots: The subplot() function takes three arguments that
describes the layout of the figure. The layout is organized in rows and columns,
which are represented by the first and second argument. The third argument
represents the index of the current plot.
11
Matplotlib
• Python Matplotlib : Types of Plots
12
Matplotlib
• Types of Plots:
• Bar Graph: A bar graph uses bars to compare data among different categories. It
is well suited when you want to measure the changes over a period of time. It can
be represented horizontally or vertically.
• Histograms: Histograms are used to show a distribution whereas a bar chart is
used to compare different entities. Histograms are useful where arrays in very
large size.
• Scatter Plot : Usually scatter plots is used to compare variables, for example,
how much one variable is affected by another variable to build a relation out of it.
The data is displayed as a collection of points, each having the value of one
variable which determines the position on the horizontal axis and the value of
other variable determines the position on the vertical axis.
13
Matplotlib
• Area Plot : Area plots are pretty much similar to the line plot. They are also
known as stack plots. These plots can be used to track changes over time for two
or more related groups that make up one whole category.
• Pie Chart: A pie chart refers to a circular graph which is broken down into
segments i.e. slices of pie. It is basically used to show the percentage or
proportional data where each slice of pie represents a category.
14
Matplotlib
• Matplotlib Scatter
15
Matplotlib
• Matplotlib Bars
16
Matplotlib
• Matplotlib Histograms
17
Matplotlib
• Matplotlib Pie Charts
18
Matplotlib
• Matplotlib Area plot
19
THANK YOU
20