pyplot

BrandonDusch's avatar
Published Oct 14, 2022
Contribute to Docs

In Matplotlib, the pyplot module provides the interface for creating figures for plotting data points on the screen.

Syntax

import matplotlib.pyplot as plt

The pyplot module is made available in an import statement and usually under an alias like plt.

pyplot

.bar()
Returns a chart/graph that represents categorical data with vertical bars.
.boxplot()
Returns a box and whisker plot.
.hist()
Creates a histogram plot that illustrates the frequency of values within a given range.
.legend()
Places a legend on the axes, allowing access to manipulate parameters of the legend.
.pie()
Creates a pie chart based on a given array of values.
.scatter()
Creates a scatter plot of x vs. y values.
.subplots()
Adds a given number of subplots to a matplotlib figure.

All contributors

Contribute to Docs

Learn Python:Matplotlib on Codecademy