×

Python Tutorial

Python Basics

Python I/O

Python Operators

Python Conditions & Controls

Python Functions

Python Strings

Python Modules

Python Lists

Python OOPs

Python Arrays

Python Dictionary

Python Sets

Python Tuples

Python Exception Handling

Python NumPy

Python Pandas

Python File Handling

Python WebSocket

Python GUI Programming

Python Image Processing

Python Miscellaneous

Python Practice

Python Programs

Python | Pyplot in Matplotlib

Python | Pyplot in Matplotlib: In this tutorial, we are going to learn about the pyplot which is a matplotlib module with the example. By Anuj Singh Last updated : August 18, 2023

matplotlib.pyplot

matplotlib.pyplot provides a number of different functions that can be used to plot and visualize our data. It also gives a free hand to do different operations with a plot such as annotations, marking, etc. In this article, we are going to learn a very basic plot type and how to label its axis and furthermore will add the Figure title.

Pyplot in Matplotlib (1)

Plotting using a single array automatically puts it on the y-axis. So adding two arrays in order (x-axis, y-axis) can produce our desired plot. One example is shown in figure 2.

Pyplot in Matplotlib (2)

Python program to demonstrate example of Pyplot in Matplotlib

# Data Visualization using Python
# Basics of Plotting

import matplotlib.pyplot as plt

# plotting using plt.pyplot()
plt.plot([4,7,3,6,1,8,9,2,3])

# axis labeling
plt.xlabel('numbers')
plt.ylabel('values')

# figure name
plt.title('Plotting Basics')

##########################################

# plotting using plt.pyplot() Figure 2
plt.plot([1,7,3,6],[1,8,9,3])

# axis labeling
plt.xlabel('numbers')
plt.ylabel('values')

# figure name
plt.title('Plotting Basics : Figure 2')
Advertisement
Advertisement

Comments and Discussions!

Load comments ↻


Advertisement
Advertisement
Advertisement

Copyright © 2025 www.includehelp.com. All rights reserved.