Introduction to Matplotlib
Master a commonly used Python graphing module, Matplotlib. Soon, you will be producing high-quality plots to visualize your data.
StartKey Concepts
Review core concepts you need to learn to master this subject
Pyplot functions
Pyplot-axis
Setting Linestyle, Color in Matplotlib
Adjusting Subplot Margins in Matplotlib
Subplots in Matplotlib
X-ticks and Y-ticks in Matplotlib
Figures in Matplotlib
Pyplot functions
Pyplot functions
The Python library Matplotlib contains the pyplot module, which provides users with an interface for graphing data. Pyplot contains over 100 functions, from acorr to yticks. You must import the module, and plt
is the standard variable name used.
from matplotlib import pyplot as plt
Here are some of the most common pyplot functions:
Function | Description |
---|---|
Plot | plots y versus x as lines and/or markers |
Show | displays a figure |
Axis | sets some axis properties |
Xlabel | sets the label for the x-axis |
Ylabel | sets the label for the y-axis |
Title | sets a title for the axes |
Subplot | adds a subplot to the current figure |
Subplots_adjust | tunes the subplot layout |
Legend | places a legend on the axes |
Figure | creates a new figure |
Savefig | saves the current figure |
What you'll create
Portfolio projects that showcase your new skills
How you'll master it
Stress-test your knowledge with quizzes that help commit syntax to memory