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

Introduction to Matplotlib in Python

Matplotlib is a low-level graph plotting library in Python that helps visualize data, identify patterns, make decisions, and communicate results. It can be installed using pip and includes the pyplot module for creating plots with functions like plot(), show(), xlabel, ylabel, and title(). A sample program demonstrates how to plot study hours against exam scores.

Uploaded by

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

Introduction to Matplotlib in Python

Matplotlib is a low-level graph plotting library in Python that helps visualize data, identify patterns, make decisions, and communicate results. It can be installed using pip and includes the pyplot module for creating plots with functions like plot(), show(), xlabel, ylabel, and title(). A sample program demonstrates how to plot study hours against exam scores.

Uploaded by

richmondtappa
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd

Matplotlib in Python

What is Matplotlib

Matplotlib is a low-
level graph plotting
library in python that
serves as a
visualization utility.
Why Do We
Need Graphs?
Visualize Data → Numbers in tables
are hard to compare, but graphs make
trends obvious.

Identify Patterns → Helps spot


increases, decreases, or sudden
changes.

Make Decisions → Graphs simplify


information so people can act on it.

Communicate Results → Easier to


explain research, experiments, or
reports.
Installation
of Matplotlib
Install it using this command:

C:\Users\Your Name>pip install


matplotlib

Checking the Version of


Matplotlib

import matplotlib
print(matplotlib.__version__)
Pyplot

pyplot is a module in Matplotlib, the popular Python


plotting library. It provides a state-machine interface for
creating plots

Import pyplot:
Import [Link] as plt
Matplotlib
Plotting
Matplotlib Functions

Plot() function
The plot() function is used to draw points (markers) in a diagram.
show() function
Allows you to display the output of your program
xlabel and ylabel
sets the label (name) of the x-axis and y-axis.
Title()
sets the title of the graphs
Sample Program
import [Link] as plt #importing library

x=[1,2,3] #values for the two


parameters
y=[2,4,2]

[Link](x,y) #function to plot the


x and y
[Link]() #function to Display the
Graph
Output
import [Link] as
plt

x=[1,2,3]
y=[2,4,2]
[Link](x,y)
[Link]()
Each student records how
Lab 1 ACTIVITY many hours they studied for
the last exam and their score.

Study Hours Exam Score


1 9
2 4
6
3

4 1

You might also like